Difference between sessionTransacted and JmsTransactionManager

What is the main difference between using sessionTransacted = true (in JmsTemplate and / or DefaultMessageListenerContainer ) and using JmsTransactionManager ? Uses sessionTransacted = true enough to use JmsTemplate and DefaultMessageListenerContainer? (I do not need XA)

Doc said (in the setSessionTransacted method in JmsAccessor ), and this doesn't seem to be the problem:

Setting this flag to true will use a short local JMS transaction when running outside of a managed transaction and a synchronized local JMS transaction in the case of a managed transaction (except XA).

+4
source share
2 answers

Correct.

In DefaultMessageListenerContainer(DMLC)you usually only need DefaultMessageListenerContainer(DMLC) acknowledgemode=transacted; you will only use the transaction manager in the DMLC if you need to synchronize a JMS transaction with, say, a JDBC transaction, or if you need to use a platform transaction manager (JTA).

In addition, any subsequent operation JmsTemplatein the container stream will be performed in the same session and participate in the transaction.

Similarly, for operations JmsTemplatein a thread that is not a container stream, you usually do not need a transaction manager, unless the platform requires it.

+3
source

, . , JmsTransactionManager ()

+1

Source: https://habr.com/ru/post/1541818/


All Articles