Consumers can filter messages using message selector. Developer has to specify a message selector (String) as an argument when we create a message consumer.
createConnectionConsumer (Destination d, String messageSelector, ServerSessionPool sp, int maxMessages) ßmethod
Message selector is a string object that contains an expression based on SQL grammer. Ex: salary BETWEEN 15k AND 30k
The message consumer will receive only the messages whose Headers and Properties match the message selector. A message selector cannot select messages on the basis of the content of the message body.