0

I have Inbound Message Listener adapter and when outbound adapter fails to open destination queue , messages are lost from source queue. I am using spring-io for jms queue message transfer.

How to commit the transfer after the message reaches destination queue or else stays in source queue?

user3467346
  • 47
  • 10

2 Answers2

0

Set acknowledge="transacted" on the message-driven-channel-adapter.

Gary Russell
  • 166,535
  • 14
  • 146
  • 179
0

It is simply a transaction propagation issue from consumer to producer. You can fix it easily by doing the below additional configurations.

If you are using DefaultMessageListenerContainer, It is strongly recommended to either set sessionTransacted to true or specify an external transactionManager.

If you did not configured a message listener container but using message-driven-channel-adapter instead, you need to set its acknowledge property to transacted.

To configure your outbound adapter to participate in transaction, you need to configure JmsTemplate as follows and set its sessionTransacted property to true:

<bean id="outboundJmsTemplate" class="org.springframework.jms.core.JmsTemplate">
    <property name="connectionFactory" ref="outboundCF" />
    <property name="defaultDestination" ref="outboundDestination" />
    <property name="sessionTransacted" value="true" />
</bean>
<int-jms:outbound-channel-adapter channel="jmsOutChannel" jms-template="outboundJmsTemplate" />

Hope it will solve your problem.

Ahsan Shah
  • 3,931
  • 1
  • 34
  • 48