[英]Publisher should wait till broker is available
我有一個簡單的發布者,它將消息發送到隊列。
<int:channel id="publishChannel"/>
<int-jms:outbound-channel-adapter channel="publishChannel" destination="testQueue" session-transacted="true"/>
@Publisher(channel = "publishChannel")
public String sendMessage (String text) {
return text;
}
如果代理崩潰,則發布者將拋出MessageHandlingException。
是否可以阻止發布者,直到代理再次可用或進行定期重試?
您可以向出站適配器添加重試建議 。
<int-jms:outbound-channel-adapter channel="publishChannel" destination="testQueue" session-transacted="true>
<int:request-handler-advice-chain>
<ref bean="myRetryAdvice" />
</request-handler-advice-chain>
</int-jms:outbound-channel-adapter>
您可以使用退避策略(例如指數)配置建議,並在重試用盡時采取一些措施(而不是拋出最終異常)。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.