aspose file tools*
The moose likes EJB and other Java EE Technologies and the fly likes One JMS queue and multiple MDB Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "One JMS queue and multiple MDB " Watch "One JMS queue and multiple MDB " New topic
Author

One JMS queue and multiple MDB

Kumar Gaurav
Ranch Hand

Joined: Apr 08, 2008
Posts: 108
Hi All,

My problem is whether we can have more than one MDB bind to a single queue and if yes how to ensure each MDB consumes its intended message meant for that MDB only.

Please help me out


Regards,
Gaurav
Vishwanath Krishnamurthi
Ranch Hand

Joined: Jun 04, 2007
Posts: 331
Hi Kumar,

You can have more than one MDB listening on a queue but only one of those (randomly picked) would receive the message.
So, no, you cannot have "each" MDB to receive that message in the first place. In this case, you can use a topic.

HTH,
Vishwa


Blog
Bruce Snyder
author
Greenhorn

Joined: Nov 03, 2010
Posts: 10
Yes, more than one MDB can listen to the same queue. The only way to target certain messages for certain MDBs is to use JMS selectors. You can find more info about JMS selectors in The JMS API Programming Model.

Bruce
Ran Pleasant
Ranch Hand

Joined: Jan 16, 2003
Posts: 75
Kumar

Keep in mind that a single large queue or topic is considered an anti-pattern. It looks good on paper but can be a dog in production and a dog to maintain. Building a number of specific queue or topic will be easier to maintain and give better performance.


Ran
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: One JMS queue and multiple MDB
 
Similar Threads
Associate Same Mdb file to multiple queue in Ejb3 jboss 5.x server
Single MDB instane - multiple messages ?
MDB-SLSB in Component Diagrams
JMS - MDB - WebSphere
MDB in connection pool