|
|
mand.ActiveMQTopicquot;gt; lt;constructor-arg value=quot;status_topicquot;/gt; lt;/beangt; lt;bean id=quot;connectionFactoryquot; class=quot;org.apache.activemq.ActiveMQConnectionFactoryquot;gt; lt;property name=quot;brokeruclquot; value=quot;tcp--localhost:61616quot;/gt; lt;/beangt;
lt;bean id=quot;messageListenerquot; class=quot;com.ss.ejbs.mdb.mdp.SSMessageListenerquot;/gt;
lt;!-- And this is the message listener container --gt;
lt;!-- --gt;
lt;bean id=quot;jmsContainerquot; class=quot;org..jms.listener.DefaultMessageListenerContainerquot;gt;
lt;property name=quot;connectionFactoryquot; ref=quot;connectionFactoryquot;/gt;
lt;property name=quot;destinationquot; ref=quot;status_topicquot;/gt;
lt;property name=quot;messageListenerquot; ref=quot;messageListenerquot;/gt;
lt;property name=quot;sessionTransactedquot; value=quot;truequot;/gt;
lt;/beangt;
lt;bean id=quot;jmsTemplatequot; class=quot;org..jms.core.JmsTemplatequot;gt; lt;property name=quot;connectionFactoryquot; ref=quot;connectionFactoryquot;/gt; lt;property name=quot;defaultDestinationquot; ref=quot;status_topicquot;/gt; lt;/beangt;
lt;/beansgt;
Listener Class:
Code:
public class SSMessageListener implements MessageListener {
/** Logger for this class and subclasses */
protected final Log log = LogFactory.getLog(getClass());
public void onMessage(Message message) {
if (message instanceof TextMessage) {
try {
//log.info(quot;Message: quot; + ((TextMessage)message).getText());
System.out.println(((TextMessage) message).getText());
} catch (JMSException ex) {
throw new RuntimeException(ex);
}
} else {
throw new IllegalArgumentException(quot;Message must be of type TextMessagequot;);
}
}
}
I deployed this code on tomcat and I sent a message to the topic using the ucl admin/
I noticed nothing happened and SSMessageListener class onMessage(message) was never invoked. Please tell me what else I need to do.
Your fast response is greatly appreciated.
Thanks in advance.
rsrch
Sorry Folks. This seems to be working. |
|