kattoor
kattoor

Reputation: 195

Recipient list Router with selector expression

I am getting the string messages in a Queue. I am consuming it and doing further processing using the below channel processMessage.

Now I have a requirement where I need to send this messages to another queue based on the selector expression mentioned below. At the same time I need to make sure that the I am not missing any records in processMessage channel. Assuming that the below configuration is good to go? or is there any better way to handle this situtaion:

  <int:recipient-list-router id="router" input-channel="incomingMsg">
           <int:recipient channel="publishToQueue" selector-expression="payload.contains('test trade') "/>
           <int:recipient channel="processMessage"/>
  </int:recipient-list-router>

    <task:executor id="executor" pool-size="10" />
    <int:publish-subscribe-channel id="publishToQueue" task-executor="executor"/>

The logical explanation is :

 IF payload.contains(test trade)
 THEN
    PublishToQueue
 END IF
 ProcessMessage

Upvotes: 0

Views: 1457

Answers (1)

Artem Bilan
Artem Bilan

Reputation: 121442

Your configuration is correct and it is really a classical sample for the Recipient List Router. You send message to the processMessage unconditionally and the same message is sent to the publishToQueue if it fits to the selector expression.

Another way to reach the same is possible via Publish-Subscribe Channel and a Filter in the beginning of the second flow. But I would say your way with the Recipient List Router is really good.

Otherwise it isn't clear what is your question and why you are in doubt to go ahead.

Upvotes: 1

Related Questions