I used the same configuration that you have given me. It seems like the previous sends are not getting rolledback.
When the router puts the message into the channel1, the message is then written to the outbound-queue1 and already been acknowledged.
When there is an error/exception in the second channel, the message from the first send is not being rolled back. Any suggestions?
Let me know if I am missing any other configuration
Queue and Topic Configurations:
Code:
<bean id="atomikosTransactionManager" class="com.atomikos.icatch.jta.UserTransactionManager"
init-method="init" destroy-method="close">
<property name="forceShutdown" value="false"/>
</bean>
<bean id="atomikosUserTransaction" class="com.atomikos.icatch.jta.J2eeUserTransaction"/>
<bean id="transactionManager" class="org.springframework.transaction.jta.JtaTransactionManager"
depends-on="atomikosTransactionManager,atomikosUserTransaction">
<property name="transactionManager" ref="atomikosTransactionManager"/>
<property name="userTransaction" ref="atomikosUserTransaction"/>
<!-- This is required for Spring Batch set set a custom isolation level when it runs -->
<property name="allowCustomIsolationLevels" value="false"/>
</bean>
<bean id="topicMainContainer" class="org.springframework.jms.listener.DefaultMessageListenerContainer"
abstract="true">
<property name="connectionFactory" ref="topicConnectionFactory"/>
<property name="subscriptionDurable" value="true"/>
<property name="pubSubDomain" value="true"/>
<property name="sessionTransacted" value="true"/>
<property name="transactionManager" ref="transactionManager"></property>
<property name="destination" ref="broadcastTopic"/>
<property name="durableSubscriptionName" value="${jms.durablename}"/>
<property name="clientId" value="${jms.durableclientid}"/>
</bean>
<bean id="topicConnectionFactory" parent="userCredentialsConnectionFactoryAdapter" lazy-init="true">
<property name="targetConnectionFactory">
<bean class="com.tibco.tibjms.TibjmsTopicConnectionFactory">
<constructor-arg index="0"
value="${ems.topic.conn.factory.url}" />
</bean>
</property>
</bean>
<bean id="queueConnectionFactory" parent="userCredentialsConnectionFactoryAdapter" lazy-init="true">
<property name="targetConnectionFactory">
<bean class="com.tibco.tibjms.TibjmsQueueConnectionFactory">
<constructor-arg index="0"
value="${ems.queue.conn.factory.url}" />
</bean>
</property>
</bean>
Message-driven-channel-adapter gets the messages, sends it to router, When the Router sends to destinations(there are two destinations)
Code:
<jms:message-driven-channel-adapter id="receiver"
container="topicMainContainer"
channel="fromBroadcast"
message-converter="MessageConverter"/>
<bean id="QueueJmsTemplate" abstract="true" class="org.springframework.jms.core.JmsTemplate"/>
<property name="messageConverter" ref="preserveUndeliveredMessageConverter" />
<property name="connectionFactory" ref="queueConnectionFactory" />
<property name="explicitQosEnabled" value="true" />
<property name="timeToLive" value="1000" />
</bean>
<si:router input-channel="fromBroadcast" ref="testRouter" method="route" />
<bean id="testRouter" class="com.xx.TestRouter">
<property name="destinations">
<map>
<entry key="1" value="channel1" />
<entry key="2" value="channel2" />
</map>
</property>
</bean>
1) Sends it to first destination channel.
This channel puts the message into the legacy-outbound-channel-adapter.
Code:
<jms:outbound-channel-adapter channel="channel1"
jms-template="toFirstDestinationQueueTemplate" />
<bean id="toFirstDestinationQueueTemplate" parent="QueueJmsTemplate">
<property name="defaultDestination" ref="SendQueue1" />
</bean>
2) Sends it to second destination channel.
This channel puts the message into the legacy-channel-outbound-adapter.
Code:
<jms:outbound-channel-adapter channel="channel2"
jms-template="toSecondDestinationQueueTemplate" />
<bean id="toSecondDestinationQueueTemplate" parent="QueueJmsTemplate">
<property name="defaultDestination" ref="SendQueue2" />
</bean>