5.6. JTA and Messaging Integration
The recommended integration method for receiving JMS messages is a JCA-endpoint based MessageListenerContainer. The processing of a message (during the call to the message handling method) is wrapped in a JTA transaction. As a result, other JTA-aware resources (datasources, entity manager factories, session factories, JMS sessions) participate in the same transaction.
Spring's JMS utility classes such as JmsTemplate and DefaultMessageListenerContainer support injection with a Spring transaction manager abstraction. By injecting the classes with the JTA-based implementation you ensure that the JMS-based operations are enrolled in JTA transactions as well.