0
votes

I am using SI configured with a jms:message-driven-channel-gateway . My use case is to receive a message from the queue, save it via JDBC to a database, commit the message from the queue, and then let this message continue to flow through the various channels depending on its type. If the message subsequently errors this is ok as I have the original stored in the database so it can be replayed.

My issue is with trying to commit the transaction from the queue immediately after the database persist. This is effectively mid flow and I have only been able to get the spring transaction management to try and commit right at the end. This is not suitable as if an error is thrown after the database persist it still leaves the message on the JMS queue, as this is where the outer transaction originated.

So, is there an easy way to pull the message from a JMS queue, save to database, then commit it off the queue ?

Thanks!

1

1 Answers

0
votes

You need to go asynch after the DB commit - use an ExecutorChannel or a QueueChannel after the DB update; the downstream flow will then run on another thread and the transactions will commit after the handoff.