0

I've been searching a lot and yes, I saw a few implementations but I still don't get how a client can consume those responses asynchronously, can anyone explain me or give me an example, please?

The only thing I got in mind now is, a little flow that sends the request using one-way exchange-pattern to specify that it will be asynchronous. Great, then what? I mean, once it's in the queue. How me, as a client, can get my messages after a certain amount of time? The correlationID takes place here, as far as I know, and maybe correlationGroups, but how do I implement this? I couldn't understand it well yet.

This is the code I made for testing async messaging, now that delivers the message to the queue, and stays there... now, it needs to be consumed somehow from the very same client when he desires to. How can I achieve that?

<jms:activemq-connector name="Active_MQ" specification="1.1" brokerURL="tcp://localhost:61616" validateConnections="false" doc:name="Active MQ">
    <reconnect frequency="5000"/>
</jms:activemq-connector>
<flow name="jms-amq-async-producerFlow1" doc:name="jms-amq-async-producerFlow1">
    <http:inbound-endpoint exchange-pattern="one-way" host="localhost" port="8081" path="asyncjms" doc:name="HTTP"/>
    <set-payload value="#['setting a new payload ']" doc:name="Set Payload"/>
    <jms:outbound-endpoint queue="AsyncQueueTest" doc:name="JMS" connector-ref="Active_MQ" disableTemporaryReplyToDestinations="true"/>
</flow>

Thanks in advance.

4

1 回答 1

2

要按需消费,请使用:

muleClient.request('jms://AsyncQueueTest?connector=Active_MQ', aTimeOut) 

您应该能够将 JMS 选择器作为额外的查询参数传递,例如:&selector=JMSMessageId%3D12456

于 2013-09-12T19:23:23.250 回答