简体   繁体   English

使用Spring Integration发送消息时,如果JMS Broker关闭,如何停止异常传播?

[英]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. 我配置了基于spring xml的拦截器,该拦截器在提交某种事务方法后,每次调用时都会向ActiveMQ队列发送一条jms消息。 It's happening with the following xml code. 以下xml代码正在发生这种情况。

<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. 但是,如果activemq服务器关闭,我会收到连接被拒绝的异常,该异常会传播出去,即使jms传递失败,我也不希望这种情况发生。 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. 最简单的解决方案是使fileredStakesChannel成为执行程序通道,并且发送将在其他线程上运行。

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#executor-channel

http://static.springsource.org/spring-integration/reference/html/messaging-channels-section.html#channel-configuration-executorchannel 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. 使用<task />命名空间定义要使用的执行程序。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 使用JPA和JMS在Spring集成测试中进行事务传播 - Transaction propagation in spring integration test with JPA and JMS 将Spring Integration JMS消息发送到特定队列(动态) - Sending spring integration jms message to specific queue (dynamically) 使用Spring Integration将消息发送到JMS目标时如何合并超时? - How to incorporate timeout while sending message to the JMS destination using Spring Integration? 当消息进入errorChannel时,Spring集成JMS和JTA回滚 - Spring Integration JMS with JTA rollback when message goes to errorChannel 停止Spring JMS消息监听器 - Stop a spring jms message listener 向 MQ 发送消息时如何删除默认的 Spring JMS 模板标头? - How to remove default Spring JMS Template headers when sending a message to an MQ? wso2消息代理+ spring集成性能 - wso2 message broker + spring integration performance Spring Integration:如何使SecurityContext传播正常工作? - Spring Integration: how to make the SecurityContext propagation working? 停止 Spring JMS 侦听器,同时仍允许 JMS 消息发布 - Stop Spring JMS listener while still allowing JMS message publishing 如何在jms-spring集成中将消息选择器注入消息监听器bean? - How to inject a message selector to message listener bean in jms-spring integration?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM