当前位置: 动力学知识库 > 问答 > 编程问答 >

fuseesb - Request only messaging with direct-vm in camel routes

问题描述:

How can we process direct-vm asynchronously?

I have the following Camel routes definition:

<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 queue consumer consumes message and sends to routeB and calls direct-vm:timeTakingRoute using threads DSL, caller thread which is queueA still waits until thread created using thread DSL completes.

How can we process this asynchronously (Caller thread should not wait until thread created using thread DSL completes)?

网友答案:

Direct component is designed to be synchronous http://camel.apache.org/direct-vm.html

Please try to use 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>
网友答案:

You can either choose seda or vm component. When using seda, note that queues are only visible within a it's CamelContext. If you want inter-communication between CamelContext, use vm component, which is an extension to seda component. Read more: seda vm

分享给朋友:
您可能感兴趣的文章:
随机阅读: