I am trying to figure out how to use a message-driven-channel-adapter with concurrent consumers and be able to withstand a system failure without losing any messages. In my current implementation I use Spring Integration and reading from an ArtemisMQ server and I need to be able to rollback any messages that fail to reach the end of the flow.
I do use the following implementation to receive messages
<int-jms:message-driven-channel-adapter
connection-factory="connectionFactory"
destination="myQueue"
message-converter="messageConverter"
channel="inputChannel"
concurrent-consumers="5"
error-channel="errorChannel"
acknowledge="transacted"
/>
but since multiple concurrent consumers are now involved transaction boundaries are now redefined and if a failure occurs then messages are lost.
My main issue is that I need multiple consumers serving messages and and at the same time I do not want to lose messages during a crash event. Is there a way to extend/propagate transaction boundaries or at least manually acknowledge each message on the end of my flow ?
I think you misunderstood something and just got confused. The concurrency doesn’t break transactions: every concurrent consumer gets its own transaction and nothing is lost if message process is done in the same thread.
I think you placing a message to different thread somewhere downstream. That’s where your tx is committed and message might be lost in case of error.
You need to revise how you process messages to keep them in the tx boundaries or really consider to use a client
ack mode to do that manually downstream.
Thanks for the response, I do have an issue losing messages when app crashes and I was under the impression that concurrent-consumers were similar to using a channel with task executors and therefore there would be issues with losing transactionality . If I can have multiple consumers with this configuration and not lose transaction semantics then it is fine by me !
If you lose messages, then it is not relevant to JMS consumer concurrency and their transactional nature.