How to change Message Selector

jms, message

Solution

JMS API does not specify a way to change the message selector once the consumer has been created. To change the message selector, a consumer must be closed and reopened with a different selector.

Problem

Is there a way to change the messageselector or do I need to close the current message consumer and create another one with a new selector string? ``` session.createConsumer(destination, "type = 'mytype'"); ``` Scenario: I want to receive a message of a specific type from the queue. After this I want to receive a message of another type from the queue.

Original source