Andriy Kryvtsun Andriy Kryvtsun - 4 months ago 37
Java Question

Transaction manager definition for Spring Integration JMS endpoint

In Spring Integration XML DSL is ability to specify transaction manager for JMS message-driven channel adapter:

<int-jms:message-driven-channel-adapter id="..."
connection-factory="..." destination="..."
channel="..." error-channel="errorChannel"
transaction-manager="processTransactionManager" auto-startup="false"/>

How to add transaction manager to my exist SI Java DSL


I wouldn't not use
DSL call here cause I have to rework my exit flow.


Like this:

        Jms.container(this.jmsConnectionFactory, ...)

There is Jms.messageDrivenChannelAdapter() to accept AbstractMessageListenerContainer implementation and as you see top-level builder from the Jms.container() factory.


For SI Java DSL 1.1.x the workaround is like:

  1. Use Jms.messageDrivenChannelAdapter(AbstractMessageListenerContainer)
  2. Configure top-level @Bean for the DefaultMessageListenerContainer
  3. And use its setTransactionManager()