【问题标题】:Camel jms to external activeMQ with request-reply gives javax.jms.InvalidDestinationException: Cannot publish to a deleted Destination:Camel jms 到外部 activeMQ 与请求-回复给出 javax.jms.InvalidDestinationException:无法发布到已删除的目的地:
【发布时间】:2013-04-16 00:13:07
【问题描述】:

我们有第三方应用程序对camel cxfrs 端点进行restful 调用,然后将其路由到外部activeMQ。有些应用程序使用这些 JMS 消息并提供 XML 响应。这一切都是使用camel InOut exchangePattern同步完成的。该架构非常简单明了。我们使用的是 activeMQ 5.5.0-fuse、camel-jms 2.8.x 和 activemq-pool 5.6。

使用此配置,我们会随机看到此异常:

 javax.jms.InvalidDestinationException: Cannot publish to a deleted Destination: temp-  queue://ID:testserver-37266-1366126830205-0:0:1
    at org.apache.activemq.ActiveMQSession.send(ActiveMQSession.java:1696)
    at org.apache.activemq.ActiveMQMessageProducer.send(ActiveMQMessageProducer.java:231)
    at org.apache.activemq.pool.PooledProducer.send(PooledProducer.java:74)
    at org.apache.activemq.pool.PooledProducer.send(PooledProducer.java:55)

当这种情况发生时,服务器会停止,我们的服务都不会响应,直到我们重新启动 activeMQ、tomcat 和所有其他服务。

骆驼配置:

<import resource="classpath:META-INF/cxf/cxf.xml"/>

 <bean id="routeBuilder" class="gov.nasa.arc.tmi.route.TMIServiceRoute"/>

 <bean id="jaxbProvider" class="org.apache.cxf.jaxrs.provider.JAXBElementProvider">
     <property name="marshallerProperties" ref="propertiesMap"/>
    </bean>
    <util:map id="propertiesMap">
        <entry key="jaxb.formatted.output">
           <value type="java.lang.Boolean">true</value>
        </entry>
    </util:map>

<camelContext id="camel" xmlns="http://camel.apache.org/schema/spring">
    <routeBuilder ref="routeBuilder"/>
</camelContext>


<bean id="activemq" 
  class="org.apache.activemq.camel.component.ActiveMQComponent">
  <property name="brokerURL" value="tcp://localhost:61616"/>

骆驼路由器类: //重新路由 来自("cxfrs:/rr?resourceClasses=x.y.z.route.RerouteResource") .setExchangePattern(ExchangePattern.InOut) .process(新的重新路由处理器()) .to("activemq:queue:x.y.z.tmi.request");

这里是监听队列的应用的spring配置:x.y.z.tmi.request消费JMS消息:

<context:annotation-config/>
<bean id="connectionFactory" class="org.apache.activemq.ActiveMQConnectionFactory">
    <property name="brokerURL">
       <value>tcp://localhost:61616? wireFormat.maxInactivityDurationInitalDelay=30000</value>
    </property>
</bean> 

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

<bean id="destination" class="org.apache.activemq.command.ActiveMQQueue">
    <constructor-arg value="gov.nasa.arc.tmi.request"/>
</bean>

<bean id="jmsTemplate" class="org.springframework.jms.core.JmsTemplate">    
    <property name="connectionFactory" ref="pooledConnectionFactory"/>
    <property name="defaultDestination" ref="destination" />
</bean> 

<jms:listener-container  connection-factory="pooledConnectionFactory" concurrency="10">
 <jms:listener  destination="gov.nasa.arc.tmi.request" ref="tmiQueryListener" />

谷歌搜索后,我发现了这些错误:

https://issues.apache.org/jira/browse/CAMEL-6229 https://issues.apache.org/jira/browse/AMQ-3457

基于这些,我们升级到camel 2.10.4、activeMq 5.7和activemq-pool 5.7。即便如此,问题依然存在。

我真的被卡住了,不知道如何解决这个问题。有人可以指出可能出了什么问题吗?

谢谢。

【问题讨论】:

  • 你好。您是否设法找到解决问题的方法?我也面临着同样的情况,我找不到任何工作方法。

标签: jms activemq apache-camel connection-pooling jmstemplate


【解决方案1】:

我想知道是不是因为另一端处理 JMS 消息的时间太长,然后 ActiveMQ 的非活动监视器将临时目标删除,因为它的非活动时间超过 30 秒。 http://activemq.apache.org/activemq-inactivitymonitor.html

也许尝试将超时设置为更高的值,或者禁用它。

另一种选择是使用固定队列代替临时队列。

【讨论】:

  • 谢谢,将尝试第一个选项。我之前尝试过修复回复队列,但是当有多个并发请求并导致服务器关闭时,它会导致服务器上的大量 CLOSE_WAIT 。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2016-06-30
  • 2017-11-16
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2014-06-19
相关资源
最近更新 更多