How does a message selector work?
As a JMS server receives messages from producing clients and evaluates which consuming client(s) it should forward each message to, the server applies a consumer's selector to data in the message header. Messages that do not meet the selection criteria are not delivered to the consumer. A message selector uses SQL92 condition syntax, for example,
session.createReceiver(queue, "DogBreed in ('Newfoundland', 'Mastiff')");
The "data" for selection criteria include certain message header fields, as well as properties attached to messages.