• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
  • Rob Spoor
  • Junilu Lacar
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Carey Brown
Bartenders:

Message listener

 
Ranch Hand
Posts: 148
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
Ranch Hand
Posts: 1258
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Sheriff
Posts: 10445
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 8944
Firefox Browser Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
JMS conversations live in the EJB and Other J2EE Technologies forum.

I'll move it there for you.

Dave
reply
    Bookmark Topic Watch Topic
  • New Topic