I have a spring integration code that connects a JMS listener (that listens to a mq series local queue)
<int-jms:message-driven-channel-adapter>
and forwards the message to a rabbitmq (not controlled by me) via a
<int-amqp:outbound-channel-adapter>
I am trying to keep this transactional meaning that if the rabbitmq did not receive the message I want to keep it in the MQ series local queue. However I noticed that if the exchange that was mentioned in the rabbitmq configurations did not exist I see in my logs this line:
ERROR (CachingConnectionFactory.java:292) - Channel shutdown: channel error; protocol method: #method<channel.close>(reply-code=404, reply-text=NOT_FOUND - no exchange 'xxx' in vhost 'xxx', class-id=60, method-id=40)
But my message disappears for the mq series local queue.
What shall i do do make it retry to send the message if the rabbitmq broker fails or if the exchange does not exists?
Thanks for your help, My configuration:
<int-jms:message-driven-channel-adapter
id="x.y.z" channel="channel-in"
error-channel="errorChannel" header-mapper="jmsIntegrationHeaderMapper"
acknowledge="transacted" destination-name="a.b.c" />
<int:channel id="channel-in">
</int:channel>
<int:header-enricher input-channel="channel-in"
output-channel="channel-out">
<int:header name="url"
expression="'amqp://${amqp.user}@${amqp.host}:${amqp.port}/${amqp.vhost}'"></int:header>
</int:header-enricher>
<int:channel id="channel-out">
</int:channel>
<int-amqp:outbound-channel-adapter
channel="channel-out" amqp-template="amqpTemplate"
routing-key="crd" mapped-request-headers="*" exchange-name="${amqp.exchange}">
</int-amqp:outbound-channel-adapter>
<rabbit:connection-factory id="amqpConnectionFactory" addresses="${amqp.host}:${amqp.port}"
cache-mode="CONNECTION"
channel-cache-size="25"
username="${amqp.user}"
password="${amqp.pass}"
virtual-host="${amqp.vhost}"/>
<rabbit:template id="amqpTemplate"
connection-factory="amqpConnectionFactory" mandatory="true" channel-transacted="true"/>