You can add an onException that catches and handles the ClosedCorrelationKeyException.
On Mon, May 9, 2011 at 7:31 AM, smozely <[email protected]> wrote: > 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 > think. > > Cheers, > Steve > > > > > > -- > View this message in context: > http://camel.465427.n5.nabble.com/Aggregator-ignore-messages-after-timeout-tp4381124p4381124.html > Sent from the Camel - Users mailing list archive at Nabble.com. > -- Claus Ibsen ----------------- FuseSource Email: [email protected] Web: http://fusesource.com CamelOne 2011: http://fusesource.com/camelone2011/ Twitter: davsclaus Blog: http://davsclaus.blogspot.com/ Author of Camel in Action: http://www.manning.com/ibsen/
