camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From smozely <>
Subject Aggregator ignore messages after timeout
Date Mon, 09 May 2011 05:31:23 GMT
Hi there,

We are attempting to implement an aggregator to implement rules around
preferring messages from one source over another with a timeout.

We have two message sources A and B which are implemented over two physical
networks, and the quality of source A is better than B.

So we have these basic rules ... 
* If a message arrives from source A just use it
* If a message arrives from source B, wait 2 minutes and if no message has
arrived from A use it

And this can be implemented reasonably easily, I have a AggregationStrategy
that prefers messages that were routed via A over messages routed via B. and
an completionPredicate that will let messages through if they arrived from A
.... and a completionTimeout to allow messages from B to be used if no A
message has arrived in 2 minutes.

I find myself in a tricky situation when a message from A arrives after the
message from B has already been forwarded on.

It seems that a late arriving A message will be treated as a new
aggregate... and so just get sent on as a new message.

If I use closeCorrelationKeyOnCompletion then I get the aggregate closed
exception and my message from A does not get processed correctly.

I was wondering if this is a case I should be able to handle easily,
something like closeCorrelationKeyOnCompletion just ignoring the messages if
the key has already been closed.

Or putting a idempotentConsumer as the next step in the chain keyed on the
same thing? ... this seems to work, just wanting to check what other people


View this message in context:
Sent from the Camel - Users mailing list archive at

View raw message