-
Oct 24th, 2011, 10:25 AM
#1
help! Spring JMS listener not receiving message
I have been stuck on this for days, appreciate if you can point me to right direction.
Need to subscribe to Tibco topic, listener approach worked before, but all the sudden it stoped receiving message.
below is the configuration xml:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd">
<bean id="propertyConfigurer"
class="org.springframework.beans.factory.config.Pr opertyPlaceholderConfigurer">
<property name="location" value="classpath:env.properties"/>
<property name="systemPropertiesModeName" value="SYSTEM_PROPERTIES_MODE_OVERRIDE"/>
</bean>
<bean id="common.userCredentialsConnectionFactoryAdapter "
class="org.springframework.jms.connection.UserCred entialsConnectionFactoryAdapter"
abstract="true">
<property name="username">
<value>${jms.userName}</value>
</property>
<property name="password">
<value>${jms.password}</value>
</property>
</bean>
<bean id="tibcoTopicConnectionFactory" parent="common.userCredentialsConnectionFactoryAda pter"
lazy-init="true">
<property name="targetConnectionFactory">
<bean class="com.tibco.tibjms.TibjmsTopicConnectionFacto ry">
<constructor-arg index="0" value="${jms.server}" />
</bean>
</property>
</bean>
<bean id="connectionFactory"
class="org.springframework.jms.connection.SingleCo nnectionFactory">
<property name="targetConnectionFactory" ref="tibcoTopicConnectionFactory" />
</bean>
<bean id="topic1" class="com.tibco.tibjms.TibjmsTopic">
<constructor-arg value="${jms.topic}" />
</bean>
<bean id="messageListener2" class="TestListener" />
<bean id="topicAddSubscriberContainer" class="org.springframework.jms.listener.DefaultMes sageListenerContainer">
<property name="connectionFactory" ref="tibcoTopicConnectionFactory"/>
<property name="clientId" value="myId2" />
<property name="destination" ref="topic1"/>
<property name="subscriptionDurable" value="true" />
<property name="durableSubscriptionName" value="n2" />
<property name="messageListener" ref="messageListener2" />
</bean>
</beans>
below is the listener code:
public class TestListener implements MessageListener {
public void onMessage(Message message) {
System.out.println("================onMessage===== ==============");
if (message instanceof TextMessage) {
try {
System.out.println(((TextMessage) message).getText());
}
catch (JMSException ex) {
throw new RuntimeException(ex);
}
}
else {
throw new IllegalArgumentException("Message must be of type TextMessage");
}
}
Enbale trace, below is the log:
2011-10-24 10:50:15,504 main DEBUG [org.springframework.jms.listener.DefaultMessageLis tenerContainer] Resumed paused task: org.springframework.jms.listener.DefaultMessageLis tenerContainer$AsyncMessageListenerInvoker@1e0799a
2011-10-24 10:50:15,519 topicAddSubscriberContainer-1 DEBUG [org.springframework.jms.connection.JmsTransactionM anager] Creating new transaction with name [topicAddSubscriberContainer]: PROPAGATION_REQUIRED,ISOLATION_DEFAULT
2011-10-24 10:50:15,535 topicAddSubscriberContainer-1 DEBUG [org.springframework.jms.connection.JmsTransactionM anager] Created JMS transaction on Session [com.tibco.tibjms.TibjmsSession@12e712f] from Connection
2011-10-24 10:50:16,551 topicAddSubscriberContainer-1 DEBUG [org.springframework.jms.listener.DefaultMessageLis tenerContainer] Consumer [TopicSubscriber[topic=SAMPLETOPIC, durable=SubscriberListener, noLocal=false]] of transactional session [com.tibco.tibjms.TibjmsSession@12e712f] did not receive a message
2011-10-24 10:50:16,551 topicAddSubscriberContainer-1 DEBUG [org.springframework.jms.connection.JmsTransactionM anager] Initiating transaction commit
2011-10-24 10:50:16,551 topicAddSubscriberContainer-1 DEBUG [org.springframework.jms.connection.JmsTransactionM anager] Committing JMS transaction on Session [com.tibco.tibjms.TibjmsSession@12e712f]
2011-10-24 10:50:16,582 topicAddSubscriberContainer-1 DEBUG [org.springframework.jms.connection.JmsTransactionM anager] Creating new transaction with name [topicAddSubscriberContainer]: PROPAGATION_REQUIRED,ISOLATION_DEFAULT
2011-10-24 10:50:16,582 topicAddSubscriberContainer-1 DEBUG [org.springframework.jms.connection.JmsTransactionM anager] Created JMS transaction on Session [com.tibco.tibjms.TibjmsSession@1363271] from Connection
Last edited by yzheng3; Oct 24th, 2011 at 10:32 AM.
-
Oct 24th, 2011, 12:05 PM
#2
anyone please help? many thanks!
an additional information, since listener doesn't work, I simply kill the process. Might this be the cause of problem? what is the correct way to terminate the container?
thanks
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules