Apache Camel - 代理关闭时的 JMS 唯一行为 [英] Apache Camel - JMS inonly behaviour when broker down

查看:26
本文介绍了Apache Camel - 代理关闭时的 JMS 唯一行为的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 Camel ActiveMQ 组件生成 ActiveMQ 实例:

I am producing to an ActiveMQ instance with a Camel ActiveMQ component:

<camel:log message="YMA_IN" />
<camel:inOnly uri="activemqBroker:queue:queue.test" id="activemqBrokerTestQueue"/>
<camel:log message="YMA_OUT" />

端点上唯一的 jms 配置是 TTL 和池连接工厂.

The only jms configuration on the endpoint is TTL and a pooled connection factory.

<amq:connectionFactory id="jmsConnectionFactory" brokerURL="${config.jms.broker.url}" />

<bean id="pooledConnectionFactory" class="org.apache.activemq.pool.PooledConnectionFactory" init-method="start" destroy-method="stop">
    <property name="maxConnections" value="15" />
    <property name="connectionFactory" ref="jmsConnectionFactory" />
</bean>

<bean id="jmsConfig" class="org.apache.camel.component.jms.JmsConfiguration">
    <property name="connectionFactory" ref="pooledConnectionFactory"/>
    <property name="timeToLive" value="${config.jms.time.to.live}" />
</bean>

<!-- Broker configuration -->
<bean id="activemqBroker" class="org.apache.activemq.camel.component.ActiveMQComponent">
    <property name="configuration" ref="jmsConfig"/>
</bean>  

如果代理宕机,交易所会一直停留在唯一的状态(登录但不退出),似乎无限期地等待代理恢复.没有例外,没有超时等......

If the broker is down, exchanges remain stuck on the inonly (logging IN but not OUT), seemingly indefinitely until the broker is back up. No exception, no timeout etc...

如果代理关闭,这是预期的行为吗?我期待一个例外?有没有我遗漏的配置?

Is this the expected behaviour if the broker is down? I was expecting an exception? Is there some configuration I am missing?

骆驼 2.10.1

推荐答案

还有使用同步发送的选项,这样客户端会更快地检测到错误(并且不必等待超时)并能够抛出一个骆驼可以检测到的异常.在

There is also options to use synchronous sends, then the client will detect the error sooner (and not have to wait for a timeout) and be able to throw an exception that Camel can detect. See some details at

这篇关于Apache Camel - 代理关闭时的 JMS 唯一行为的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆