【发布时间】:2017-03-22 05:19:20
【问题描述】:
我想使用骆驼休息调用来触发长时间操作。由于该操作需要大量时间,因此请求将超时并在客户端显示错误消息。我不希望这种情况发生。
所以,我正在尝试使用队列来解决这个问题,如下所示:
<bean id="activemq" class="org.apache.activemq.camel.component.ActiveMQComponent">
<property name="brokerURL" value="tcp://0.0.0.0:61616" />
<property name="userName" value="admin"/>
<property name="password" value="admin"/>
</bean>
<camelContext xmlns="http://camel.apache.org/schema/blueprint" trace="true">
<route>
<from uri="cxfrs:bean:rsprovider" />
<setBody>
<simple>${header.operationName}</simple>
</setBody>
<to uri="activemq:queue:myqueue"/>
<!-- Send immediate response to client as, the processing will take a while -->
<setBody>
<simple>Received feeder service request to ${header.operationName}. Request will be processed soon.</simple>
</setBody>
</route>
<route>
<from uri="activemq:queue:myqueue"/>
<convertBodyTo type="java.lang.String"/>
<recipientList>
<simple>direct-vm:operation-${body}</simple>
</recipientList>
</route>
</camelContext>
但是,添加到队列似乎是同步的,并且没有按时收到响应。我怎样才能使这个队列异步?我尝试将?jms.useAsyncSend=true 附加到队列网址。但这没有用。
【问题讨论】:
标签: apache-camel activemq jbossfuse