-
Jun 24th, 2009, 02:29 PM
#1
To call Default Message Listener
Hi Folks,
I plugged in my Message Listener as below:
<!-- and this is the message listener container -->
<bean id="jmsContainer" class="org.springframework.jms.listener.DefaultMes sageListenerContainer">
<property name="connectionFactory" ref="connectionFactory"/>
<property name="destination" ref="destination"/>
<property name="messageListener" ref="messageListener" />
</bean>
<!-- this is the Message Driven POJO (MDP) -->
<bean id="messageListener" class="nj.lwd.jms.listener.ExampleListener" />
And i declared my onMessage method in my "ExampleListener" and here is the code for it:
public class ExampleListener implements MessageListener {
public void onMessage(Message message) {
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");
}
}
}
Can any one help me how the "onMessage" method will be called when there is some message in my Queue.
Are there any additional plug-ins need to by done to call this asynchronously.
Thanks in Advance,
N.Naveen.
-
Jun 24th, 2009, 04:53 PM
#2
Please use [ code][/code ] tags when posting code that way it remains readable.
What you posted should be all you need.
-
Jun 25th, 2009, 07:58 AM
#3
To call Default Message Listener
Hi Folks,
Can i know how that <bean id="jmsContainer"> pointing to [class="org.springframework.jms.listener.DefaultMes sageListenerContainer"] will be called.
Thanks And Regards,
N.Naveen.
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