Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Request only is when the caller sends a message but do not expect any reply. This is also sometimes known as fire and forget or event message.

...

Notice: As Camel always returns a Future handle for Async messaging to the client. The client can then use this handler or not to get hold of the status of the processing whether the task is complete or an Exception occured during processing. Note that the client is not required to do so, its perfect valid to just ignore the Future handle.

Tip
Knowing if an Asynchronous Request Only failed
Knowing if an Asynchronous Request Only failed

In case you want to know whether the Async Request Only failed, then you can use the Future handle and invoke get() and if it throws a ExecutionException then the processing failed. The caused exception is wrapped. You can invoke isDone() first to test whether the task is done or still in progress. Otherwise invoking get() will wait until the task is done.

...

Wiki Markup
{snippet:id=e1|lang=java|url=camel/trunk/tests/camel-itest/src/test/java/org/apache/camel/itest/async/HttpAsyncDslTest.java}
Warning
titleTransactions and async DSL

Mind that when using transactions its often required that the Exchange is processed entirely in the same thread, as the transaction manager often uses ThreadLocal to store the intermediate transaction status. For instance Spring Transaction does this. So when using async DSL the Exchange that is processed in the async thread cannot participate in the same transaction as the thread before the async DSL.

Notice: This does not apply to the ProducerTemplate Async API as such as the client usually does not participate in a transaction. So you can still use the Camel Client Async API and do async messaging where the processing of the Exchange is still handled within transaction. Its only the client that submitted the Exchange that does not participate in the same transaction.

See Also