You define the criteria for message selection of a particular consumer, specifying conditions on the values of the message properties, and using the message selector expression.
String selector; selector = new String("(name = 'searched_string') OR (name = 'another_searched_string')"); |
● When you use a Topic connection, the message consumer creation looks as follows:
subscriber = topicSession.createSubscriber(topic, selector); |
● When you use a Queue connection, the message consumer creation looks as follows:
receiver = queueSession.createReceiver(queue, selector); |
For more information about the message selector syntax, see Message Selector Syntax.