Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Message listener  RSS feed

 
Vicky Pandya
Ranch Hand
Posts: 148
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What is general way of implementing javax.jms.MessageListener interface for JMS subscriber. I am using tomcat 5 so no room for using MDB. What is the other way of achieving this? Servlet Listener or something else?
 
Nathaniel Stoddard
Ranch Hand
Posts: 1258
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Any class you define can implement MessageListener. It doesn't have to a MDB.
 
Vicky Pandya
Ranch Hand
Posts: 148
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Nathaniel:- Yes, I do understand that any class I define can implement MessageListener interface. My question was, what is the general way of making this component running in memory so whenever message comes onMessage gets called. I wanted to know how you keep this thread running into memory continiously looking for message? Making it servlet or something else? any pointers would be much appreciated.
 
Jaikiran Pai
Sheriff
Posts: 10447
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Vicky Pandya:
I wanted to know how you keep this thread running into memory continiously looking for message?


The message listener need not be in memory. It will be instantiated once a message arrives at the destinations, on which this is listening.
 
Pradeep bhatt
Ranch Hand
Posts: 8933
Firefox Browser Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Vicky Pandya:
What is general way of implementing javax.jms.MessageListener interface for JMS subscriber. I am using tomcat 5 so no room for using MDB. What is the other way of achieving this? Servlet Listener or something else?


If it was a stand alone client you would need to keep the thread alive. See samples here
http://java.sun.com/products/jms/tutorial/1_3_1-fcs/doc/client_samples.html#1006838

Since your client is running on tomcat no worries.
 
David O'Meara
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
JMS conversations live in the EJB and Other J2EE Technologies forum.

I'll move it there for you.

Dave
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!