简体   繁体   中英

How to stop exception propagation if jms broker is down when sending a message with spring integration?

I configured spring xml based interceptor, which sends a jms message to activemq queue on each invokation of some transactional method after it is commited. It's happening with the following xml code.

<jms:outbound-channel-adapter channel="filteredStakesChannel" destination="stakesQueue" delivery-persistent="true" explicit-qos-enabled="true" />

But if the activemq server is down i get connection refused exception, which is propagated and i don't want this to happen even if the jms delivery fails. Is this possible? Should i use some error-channel?

The simplest solution is to make fileredStakesChannel an Executor channel and the send will run on a different thread.

http://static.springsource.org/spring-integration/reference/html/messaging-channels-section.html#executor-channel

http://static.springsource.org/spring-integration/reference/html/messaging-channels-section.html#channel-configuration-executorchannel

Use the <task/> namespace to define an executor to use.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM