Request messaging only with direct-vm on camel routes

How can we handle direct-vm asynchronously?

I have the following definition for camel routes:

<route id="routeA">
<from uri="activemq:queue:queueA" />
<to uri="direct-vm:someProcessing" />
<to uri="direct-vm:processAsync" />
</route>

<route id="routeB">
<from uri="direct-vm:processAsync">
<threads executorServiceRef="someRef">
 <inOnly uri="direct-vm:timeTakingRoute" />
<threads>
<route>

      

When a queue consumer consumes a message and dispatches to routeB and invokes direct-vm:timeTakingRoute

the streams using DSL streams, the caller's stream, which queueA

is still waiting for the stream created using the stream DSL, has terminated.

How can we handle this asynchronously (the Caller thread should not wait for the thread created using the DSL stream to complete)?

+3


source to share


2 answers


Direct component is for synchronous http://camel.apache.org/direct-vm.html

Try using seda instead :



<route id="routeA">
    <from uri="activemq:queue:queueA" />
    <to uri="direct-vm:someProcessing" />
    <inOnly uri="seda:processAsync" />
</route>

<route id="routeB">
    <from uri="seda:processAsync" />
    <to uri="direct-vm:timeTakingRoute" />
</route>

      

+3


source


You can choose seda

or vm

. When using seda, note that the queues are only visible inside the CamelContext. If you want to communicate between CamelContext

, use a component vm

that is an extension to the component seda

. Read more: seda vm



+1


source







All Articles