簡體   English   中英

使用Spring Integration發送消息時,如果JMS Broker關閉,如何停止異常傳播?

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

我配置了基於spring xml的攔截器,該攔截器在提交某種事務方法后,每次調用時都會向ActiveMQ隊列發送一條jms消息。 以下xml代碼正在發生這種情況。

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

但是,如果activemq服務器關閉,我會收到連接被拒絕的異常,該異常會傳播出去,即使jms傳遞失敗,我也不希望這種情況發生。 這可能嗎? 我應該使用一些錯誤通道嗎?

最簡單的解決方案是使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#channel-configuration-executorchannel

使用<task />命名空間定義要使用的執行程序。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM