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 ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access