1
votes

I have an application with two queues, the first queue has control messages and the other has data messages. Based on the JMSCorrelationID of the message from the control queue i need to read only messages with that JMSCorrelationID from the data queue.

I am able to selectively read messages from the data queue using a selector defined as below.

<int-jms:message-driven-channel-adapter id="messageDrivenInboundAdapter"
    channel="inboundChannel" destination-name="inboundMQ"
    selector="JMSCorrelationID = 'JMSCORELIS1234'"
    connection-factory="connectionFactory" extract-payload="false"/>

I need to dynamically update value for the JMSCorrelationID for the selector based on messages received on a different channel.

Is it possible to do that? Is there a different way to implement this solution in spring integration?

1

1 Answers

0
votes

It's not possible with the message-driven adapter; the selector is baked into the message listener container constructed during initialization.

You can change the message selector of a polled <inbound-channel-adapter/>; the change will take effect on the next poll.

You can get a handle to the JmsDestinationPollingSource with auto wiring, or via the bean name (adapterId.source).