Hi,

I'm wondering if the following scenario can be implemented using standard
Camel components (ie. without using a custom processor and /or custom
components).

Consider a synchronous InOut exchange that triggers some asynchronous
backend processing. The response that needs to be generated for the
exchange requires the result of this asynchronous processing step.
Correlation of the original exchange and the backend result is possible via
data in the payload.

In Camel terms the routes would look somewhat akin to this:

from("receiveInOut").
process("add correlation ID to cache").
to("seda:triggerAsyc").
process("block until timeout or cache updated with correlation ID").
to("direct:generateResponse");

from("direct:backendResponse").
process("update cache with correlation id");


The main issue as I see it is that the "backendResponse" endpoint can
receive responses for various exchanges in more or less random order so I
cannot simply use an aggregation with pollEnrich. I could not find a
component that allows blocking on a cache update. My solution at the moment
would be to wrap the "add correlation ID", "triggerAsync", and "block on
cache" steps in a custom processor. That should work, but the scenario
seems common enough that I feel I might be missing some crucial puzzle
piece from the Camel toolbox. Am I?

Regards,
Jens

Reply via email to