Reputation: 11
I am sending a request to a rest api from queue, and getting a response back.if the response is not 201 then I have to push the same request to the queue again for a second time. But when I am pushing it to the queue, I am getting an error, like the one below:
org.apache.camel.ExchangeTimedOutException: The OUT message was not received within: 20000 millis due reply message with correlationID: Camel-ID-01HW828056-64538-1479908182896-32-4 not received on destination: temp-queue://ID:01HW828056-64546-1479908191870-15:3:1.
this is my 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} > 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>
Upvotes: 0
Views: 1639
Reputation: 4316
Somewhere a JMSReplyTo header is being specified and the activemq component is creating a consumer on a temp-queue waiting for a response. The response is not being returned in 20,000 ms, so the activemq component is giving up and throwing the error.
The automatic replyTo handling can be disabled by adding the following options to the activemq endpoint:
?disableReplyTo=true&preserveMessageQos=true
See notes here: Camel JMS Component
Upvotes: 1