ActiveMQ 请求-回复超时

发布于 2024-12-09 04:24:57 字数 2642 浏览 1 评论 0原文

我有这个 activeMQ 问题,我向远程代理发送请求(从 Camel 应用程序)。请参阅下面的配置:

<bean id="providerJMSConnectionFactory" class="org.apache.activemq.ActiveMQConnectionFactory">
    <property name="alwaysSessionAsync" value="false"/>
    <property name="alwaysSyncSend" value="true"/>
    <property name="brokerURL"><value>${remote-broker-url}</value></property>
    <property name="clientID" value=""/>
    <property name="closeTimeout" value="150000"/>
    <property name="copyMessageOnSend" value="true"/>
    <property name="disableTimeStampsByDefault" value="false"/>
    <property name="dispatchAsync" value="false"/>
    <property name="objectMessageSerializationDefered" value="false"/>
    <property name="optimizeAcknowledge" value="true"/>
    <property name="optimizedMessageDispatch" value="true"/>
    <property name="password" value=""/>
    <property name="producerWindowSize" value="0"/>
    <property name="statsEnabled" value="false"/>
    <property name="useAsyncSend" value="false"/>
    <property name="useCompression" value="false"/>
    <property name="useRetroactiveConsumer" value="false"/>
    <property name="userName" value=""/>
    <property name="watchTopicAdvisories" value="true"/>
    <property name="sendTimeout" value="0"/>
</bean>

<bean id="aeroProviderJMSConfig" class="org.apache.camel.component.jms.JmsConfiguration">
    <property name="connectionFactory" ref="providerJMSConnectionFactory"/>
    <property name="deliveryPersistent" value="true"/>
    <property name="explicitQosEnabled" value="true"/>      
    <property name="priority" value="${jms-message-priority}"/>
    <property name="acceptMessagesWhileStopping" value="false"/>    
</bean>
<bean id="providerJMS" class="org.apache.camel.component.jms.JmsComponent">
    <property name="configuration" ref="providerJMSConfig"/>        
</bean>

 <osgi:camelContext xmlns="http://camel.apache.org/schema/spring" trace="true">
   <endpoint id="providerEndpoint" uri="providerJMS:queue:provider?replyTo=providerResponse&requestTimeout=120000"/>
       <route>
    <from .....>
     <to ref="providerEndpoint"/>
   ....
    </route>

每当我检查远程代理上的“providerResponse”队列时,我意识到响应消息永远不会被拾取。即使我要求响应消息在那里排队(实际上已经完成),它仍然保留在消息中。

我的问题是,为什么骆驼会拒绝从这个队列中获取这条消息? 请注意,交换模式已明确设置为 InOut。

我注意到它说 CorrelationID 不一样,即使我检查请求的 JMSCorrelationID 和响应对我来说看起来是一样的。

是否有可用于匹配 JMS 请求/回复响应的备用选择器?

I have this activeMQ issue where I send a request to a remote broker (from a Camel Application). See config below:

<bean id="providerJMSConnectionFactory" class="org.apache.activemq.ActiveMQConnectionFactory">
    <property name="alwaysSessionAsync" value="false"/>
    <property name="alwaysSyncSend" value="true"/>
    <property name="brokerURL"><value>${remote-broker-url}</value></property>
    <property name="clientID" value=""/>
    <property name="closeTimeout" value="150000"/>
    <property name="copyMessageOnSend" value="true"/>
    <property name="disableTimeStampsByDefault" value="false"/>
    <property name="dispatchAsync" value="false"/>
    <property name="objectMessageSerializationDefered" value="false"/>
    <property name="optimizeAcknowledge" value="true"/>
    <property name="optimizedMessageDispatch" value="true"/>
    <property name="password" value=""/>
    <property name="producerWindowSize" value="0"/>
    <property name="statsEnabled" value="false"/>
    <property name="useAsyncSend" value="false"/>
    <property name="useCompression" value="false"/>
    <property name="useRetroactiveConsumer" value="false"/>
    <property name="userName" value=""/>
    <property name="watchTopicAdvisories" value="true"/>
    <property name="sendTimeout" value="0"/>
</bean>

<bean id="aeroProviderJMSConfig" class="org.apache.camel.component.jms.JmsConfiguration">
    <property name="connectionFactory" ref="providerJMSConnectionFactory"/>
    <property name="deliveryPersistent" value="true"/>
    <property name="explicitQosEnabled" value="true"/>      
    <property name="priority" value="${jms-message-priority}"/>
    <property name="acceptMessagesWhileStopping" value="false"/>    
</bean>
<bean id="providerJMS" class="org.apache.camel.component.jms.JmsComponent">
    <property name="configuration" ref="providerJMSConfig"/>        
</bean>

 <osgi:camelContext xmlns="http://camel.apache.org/schema/spring" trace="true">
   <endpoint id="providerEndpoint" uri="providerJMS:queue:provider?replyTo=providerResponse&requestTimeout=120000"/>
       <route>
    <from .....>
     <to ref="providerEndpoint"/>
   ....
    </route>

Whenever I check the "providerResponse" queue on the remote broker, I realise the resposne message is never picked up. it remains in the message even I had asked response messages be queued in there (which was actually done).

My question is, why will the Camel refuse to get this message from this queue?
Note that Exchange pattern was explicitly set to InOut.

I noticed it said the CorrelationID were not the same even though I check the JMSCorrelationID for the request and the response which look the same to me.

Is there an alternate Selector I can use for matching JMS Request/Reply response?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

ㄖ落Θ余辉 2024-12-16 04:24:57

尝试使用 ,而不是使用 。如果省略 URI 上的replyTo 参数,Camel 将创建一个临时队列,仅用于该响应。

Rather than using <to ref="providerEndpoint"/> try <inOut ref="providerEndpoint"/>. If you omit the replyTo parameter on the URI, Camel wil create a temporary queue to be used for that response only.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文