I am trying to wrap my head arround the following issue:
TL;DR How can I make sure a rollback occurs when connection is lost to the queue manager during the prepare of the 2PC.
- java: 8
- spring boot: 2.3.12.RELEASE
- spring-jms: 5.2.20.RELEASE
- mq-jms-spring-boot-starter: 2.6.5 (allclient: 9.2.5.0)
- narayana spring boot starter: 2.6.3 (narayana: 5.11.3.Final)
- sniffy: 3.1.12
==========================================================
- Application is reading a persistent message (without expiry) from queue X in a transaction
- I set a breakpoint in the XAResouceRecord.topLevelPrepare and using Sniffy I cut the the connection to the queue manager during the 2PC prepare
- I wait more than the HBINT (300) time (or shutdown the VM to disconnect the TCP connections instantly)
- I expected the message to be available on the message queue X, it's back-out queue or a dead letter queue
However, the message is not rolled back. I don’t see any transaction logs (I believe this is to be expected since the prepare did not finish). No uncommitted messages on the queue or back-out queue.
If I put a breakpoint in AbstractPollingMessageListenerContainer.receiveAndExecute after receiving the message but before the transaction is commited I can see that the message is no longer on the queue. So it appears if the session.commit has already happened. How can I make sure a rollback occurs when connection is lost to the queue manager during the prepare of the 2PC. I am probably missing something here but I can't seem what.