You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When an external JTA/EJB transaction calls a transactional spring bean (using JtaTransactionManager), which in turn sends a RabbitMQ-message (using RabbitTemplate), then the message is committed on the channel when the spring transaction bracket ends (not as expected when the outer JTA transaction is committed).
The reason seems to be, that AbstractPlatformTransactionManager.processCommit() executes onCommit() callbacks immediately (whereas afterCompletion-Callbacks are passed on to a surrounding transaction). As the RabbitTemplate uses onCommit() callbacks (see RabbitResourceSynchronization) this causes the described behavior.
Moving the channel commit to afterCompletion in RabbitResourceSynchronization should fix this problem.