Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

asynchronous jms consumer

 
gionny deep
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all
I want to create an asynchronous jms consumer.
The problem is that i do not want create a message driven bean.
I have a session bean that dynamically read from data base the name of the queue listened.
So i wonder if exists a way for implementing a asynchronous jms consumer.
Please help!!!
Regards
 
Jaikiran Pai
Marshal
Pie
Posts: 10447
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have a look at:

QueueReceiver

MessageConsumer

Though the following example is from jboss articles, this is not specific to jboss, and can be used as a reference:

Example from JBoss
 
Jaikiran Pai
Marshal
Pie
Posts: 10447
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
asynchronous jms consumer


Thought about your question once again. Do you mean to say, your consumer should act similar to MDB(which get invoked when the message arrives on queue). If yes, then the links that i provided in my previous post may not be useful, because, the QueueReceiver uses the receive method(which is a blocking, i.e. synchronous method) *waits* for a message to arrive on the queue.
 
Pradeep bhatt
Ranch Hand
Posts: 8933
Firefox Browser Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Use MessageListener for receiving asynchronous messages
http://java.sun.com/j2ee/1.4/docs/api/javax/jms/MessageListener.html
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic