1
votes

I am using Spring Integration to read a message from the queue and write it out to multiple queues. In case of any failure, I want the message to be written to a failure queue and none of the output queues should have received the message. To achieve this, how can I set up my transactions? I am using a message driven channel adapter on the inbound and a jms outbound channel adapter. I am using a splitter to create multiple messages (based on number of output queues) that are provided to the jms outbound channel adapter. The flow will be running as a standalone java application.

Thanks.

1

1 Answers

0
votes

You can achieve that using JMS stuff:

  1. You should configure redelivery policy for the inbound queue to 0
  2. And provide a DLQ for that.

In that case on the TX rollback your message won't be redelived to your listener one more time and just will go to the DLQ.

See more info in the JMS spec.

UPDATE

The solution according Gary's advice: https://gist.github.com/artembilan/e7aff2afbf4ff4308159