处理路径中的超时错误

时间:2016-11-23 14:26:33

标签: apache-camel activemq jbossfuse

我正在向队列中的rest api发送请求,并获得响应。如果响应不是201,那么我必须再次将相同的请求推送到队列中。但是当我将它推入队列时,我收到一个错误,如下所示:

  

org.apache.camel.ExchangeTimedOutException:未收到OUT消息:20000毫秒到期回复消息,其中包含相关ID:Camel-ID-01HW828056-64538-1479908182896-32-4未在目标上收到:temp-queue:/ / ID:01HW828056-64546-1479908191870-15:3:1

这是我的blueprint.xml

<?xml version="1.0" encoding="UTF-8"?>
<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
    xmlns:cm="http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.0.0"
    xmlns:cxf="http://camel.apache.org/schema/blueprint/cxf"
    xmlns:cxf-core="http://cxf.apache.org/blueprint/core"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="              http://www.osgi.org/xmlns/blueprint/v1.0.0 http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd              http://camel.apache.org/schema/blueprint/cxf http://camel.apache.org/schema/blueprint/cxf/camel-cxf.xsd              http://camel.apache.org/schema/blueprint http://camel.apache.org/schema/blueprint/camel-blueprint.xsd">

  <camelContext xmlns="http://camel.apache.org/schema/blueprint" trace="false">
    <route id="fromqueuecontext">
         <from uri="activemq:queue:request?asyncConsumer=true"/>
          <unmarshal>
            <jaxb partClass="partclassname" prettyPrint="true" contextPath="contextname"/>
        </unmarshal>  
        <setProperty propertyName="capturequeuebean">
            <simple>${body}</simple>
        </setProperty>
        <log message="${property.capturequeuebean.orderNum}"/>
        <log message="${property.capturequeuebean.transactionNumber}"></log>
                     <removeHeaders pattern="*" />
                    <setHeader headerName="CamelHttpMethod" id="_setHeader1">
                        <constant>PUT</constant>
                    </setHeader>
                    <setHeader headerName="Content-Type" id="_setHeader2">
                        <constant>application/json</constant>
                    </setHeader>

                    <setBody>
                        <simple>${body.captureRequest}</simple>
                    </setBody>

                    <marshal>
                        <json library="Jackson"/>
                    </marshal>
                    <log message="sending body ${body}"/>
                    <convertBodyTo type="java.io.InputStream" id="_convertBodyTo1" />          
                    <recipientList>
                        <simple><!--url to be sent --></simple>
                    </recipientList>
                    <log message="${header.CamelHttpResponseCode}" />
                    <choice>
                        <when>
                            <simple>${header.CamelHttpResponseCode} != 201 and ${property.capturequeuebean.count} &gt; 0</simple>

                             <log message="inside 1st when"></log>
                            <setBody>
                                <simple>${property.capturequeuebean}</simple>
                            </setBody>
                             <bean ref="CaptureBusinessImpl" method="changecount"></bean>
                             <log message="${body.count}"></log> 
                            <to uri="activemq:queue:request" /> 
                        </when>
                        <otherwise>
                            <choice>
                                <when>
                                    <simple>${header.CamelHttpResponseCode} == 201 </simple>
                                    <log message="Sucess"></log>
                                </when>
                                <otherwise>
                                    <choice>
                                        <when>
                                            <simple>${property.capturequeuebean.count} == 0</simple>
                                            <log message="exception"></log>
                                        </when>
                                    </choice>
                                </otherwise>
                            </choice>
                        </otherwise>
                    </choice>
    </route>
  </camelContext>

</blueprint>

1 个答案:

答案 0 :(得分:1)

某处正在指定JMSReplyTo标头,而activemq组件正在等待响应的临时队列上创建使用者。响应没有在20,000毫秒内返回,因此activemq组件放弃并抛出错误。

可以通过将以下选项添加到activemq端点来禁用自动replyTo处理:

?disableReplyTo=true&amp;preserveMessageQos=true

请参阅此处的说明:Camel JMS Component