wood burning stoves 2.0*
The moose likes EJB and other Java EE Technologies and the fly likes jms MessageListener Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "jms MessageListener" Watch "jms MessageListener" New topic
Author

jms MessageListener

Mary Anu
Greenhorn

Joined: May 01, 2004
Posts: 10

Hi,

I need to write a listener class which will listen to the messages in queue. but before to tht is it required get the connection to the specified queue? If so how? as to my understanding the listener class is started when the web app is loaded and onMessage() is executed. But where shud i write the code for getting the connection? In my case the queue is already running. i only need to listen to that particular queue for getting the message and process it.

Thanks
mary
Henrique Ordine
Ranch Hand

Joined: Sep 03, 2004
Posts: 127
Hello Mary Anu,

I think only message producers need to get connections to the queue. In your case, you're writing a message consumer, and I think you're right. The onMessage() method will be invoked by the container when a message arrives at the queue, and this message will be passed to onMessage() as an argument of type javax.jms.Message.


J2EE Architect/Developer
Mary Anu
Greenhorn

Joined: May 01, 2004
Posts: 10

Hi Henrique Ordine, Thanks for your reply... in that case whr should i specify the queue name which the listener listens to. i have read that configurations are done in web.xml. could you pls explain how it is to be done. my app id running in jboss.

Mary
[ January 17, 2008: Message edited by: Mary Anu ]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: jms MessageListener
 
Similar Threads
JUNIT and writting test case for MDB
JNDI setup for MyEclipse and TomCat
Proble with JMS Queue.
Duplicate JMS message processing with multiple MessageListener threads
How to build Messaging function in Swing Application?