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.
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.
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.
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
Yeah, but how did the squirrel get in there? Was it because of the tiny ad?
a bit of art, as a gift, the permaculture playing cards