0
我想用骆驼休息时间呼叫触发长时间操作。由于该操作需要花费大量时间,因此请求会超时并在客户端显示错误消息。我不希望发生这种情况。使用骆驼休息服务触发长时间操作
所以,我想用队列如下解决这个问题:
<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
到队列的URL。但那并不奏效。