JMS - How do message selectors work with multiple queue and topic consumers?

Posted by Stephen Harmon on Stack Overflow See other posts from Stack Overflow or by Stephen Harmon
Published on 2010-05-13T16:51:46Z Indexed on 2010/05/13 16:54 UTC
Read the original article Hit count: 214

Filed under:
|
|

Say you have a JMS queue, and multiple consumers are watching the queue for messages. You want one of the consumers to get all of a particular type of message, so you decide to employ message selectors.

For example, you define a property to go in your JMS message header named, "targetConsumer." Your message selector, which you apply to the consumer known as, "A," is something like "WHERE targetConsumer = "CONSUMER_A."

It's clear that consumer A will now just grab messages with the property set like it is in in the example. Will the other consumers have awareness of that, though? IOW, will another consumer, unconstrained by a message selector, grab the "CONSUMER_A" messages, if it looks at the queue before Consumer A? Do I need to apply message selectors like, "WHERE targetConsumer <> "CONSUMER_A" to the others?

I am RTFMing and gathering empirical data now, but was hoping someone might know off the top of their head.

© Stack Overflow or respective owner

Related posts about jms

Related posts about java