【问题标题】:Publisher should wait till broker is available发布者应等到经纪人可用
【发布时间】:2015-08-08 01:21:12
【问题描述】:

我有一个简单的发布者,它将消息发送到队列。

<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。

是否可以阻止发布者,直到代理再次可用或定期重试?

【问题讨论】:

    标签: spring jms spring-integration spring-jms


    【解决方案1】:

    你可以add a retry advice to the outbound adapter

    <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>
    

    您可以使用退避策略(例如指数)配置建议,并在重试用尽时采取一些措施(而不是抛出最终异常)。

    【讨论】:

      猜你喜欢
      • 2021-10-13
      • 1970-01-01
      • 1970-01-01
      • 2021-02-12
      • 2021-06-23
      • 1970-01-01
      • 1970-01-01
      • 2018-02-19
      • 2017-07-05
      相关资源
      最近更新 更多