...
Option | Description |
---|---|
poolSize | A number to indicate the core pool size of the underlying Java |
executorService | You can provide a custom |
waitForTaskToComplete | Option to specify if the caller should wait for the async task to be complete or not before continuing. The following 3 options is supported: Always, Newer or IfReplyExpected. The first two options is self explained. The last will only wait if the message is Request Reply based. The default option is IfReplyExpected. |
Example: async DSL
Suppose we receive orders on a JMS queue. Some of the orders expect a reply while other do not (either a JMSReplyTo
exists or not). And lets imagine to process this order we need to do some heavy CPU calculation. So how do we avoid the messages that does not expect a reply to block until the entire message is processed? Well we use the async
DSL to turn the route into asynchronous routing before the heavy CPU task. Then the messages that does not expect a reply can return beforehand. And the messages that expect a reply, well yeah they have to wait anyway. So this can be accomplished like the route below:
Wiki Markup |
---|
{snippet:id=e1|lang=java|url=camel/trunk/tests/camel-itest/src/test/java/org/apache/camel/itest/async/HttpAsyncDslTest.java} |