Working with asynchronous APIs
Very occasionally you will want to interact with a third-party API that is asynchronous in nature (that is, one that uses callbacks to return a response) within a Camel Processor.
The most straightforward way to do this is to register a listener with that API, place a request, and block the current thread until a response is received using a java.util.concurrent.CountDownLatch
instance or similar. This has the downside of using one more thread than you strictly need to, and potentially slows down the rate of consumption from the route's consumer endpoint.
This recipe provides you with an alternative that allows you to truly interact asynchronously with this type of API through an Asynchronous Processor . Using this mechanism, the original thread is released to take on more work once the request has been placed, and the response is routed using the thread that triggers the callback.
Note
This is an advanced recipe that should only be used by developers leveraging...