Hi all, I've finally solved setting AGGREGATION_COMPLETE_ALL_GROUPS to true in my 'signal' message. Probably it would be a good idea moving it from the bottom of the documentation into the parameters table so people may find it easily. Ref: http://camel.apache.org/aggregator2.html
My two cents: It's not clear why this is not considered a completion strategy and it's handled as a special case. Don't you think we could try to define a completionOnEvent or better defining a default implementation of a completionPredicate which expects the aggregationCompleteAllGroups==true (I could try to provide a quick patch if you agree). Claus thanks for your suggestions. Cheers, Carlo 2014-06-06 17:12 GMT+02:00 Claus Ibsen <claus.ib...@gmail.com>: > On Fri, Jun 6, 2014 at 5:01 PM, carlo cancellieri > <c.cancelli...@proximainformatica.com> wrote: > > Claus, > > > >> You get an invalid correlation key, so check that. > >> > >> <!-- correlate by header with the key id --> > >> <correlationExpression> > >> <header>aggrId</header> > >> </correlationExpression> > >> > > > > Yes, I've added it to skip that error but the incoming (fake) exchange is > > still passed to the aggregation while what I need is to complete the > > aggregation without this message. > > It should be considered as a trigger not as a message (to aggregate) > > shipping the completionPredicate. > > I don't know when the aggregation should be considered completed until I > > receive this message (which may never be aggregated). > > > > Then just do not merge it in your aggregation strategy implementation. > > > > > > >> > >> Do you have that header > >> > >> On Fri, Jun 6, 2014 at 4:37 PM, carlo cancellieri > >> <c.cancelli...@proximainformatica.com> wrote: > >> > Dear Claus, > >> > I'm trying to use the suggested flag eagerCheckCompletion="true" > with no > >> > success. > >> > I still get: > >> > org.apache.camel.CamelExchangeException: Invalid correlation key. > >> > Exchange[test_complete.csv] > >> > at > >> > > >> > org.apache.camel.processor.aggregate.AggregateProcessor.doProcess(AggregateProcessor.java:204) > >> > at > >> > > >> > org.apache.camel.processor.aggregate.AggregateProcessor.process(AggregateProcessor.java:179) > >> > at > >> > > >> > org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:72) > >> > > >> > Here: > >> > > >> > org.apache.camel.processor.aggregate.AggregateProcessor.doProcess(Exchange): > >> > 197 > >> > the correlation id is still evaluated but it is actually not existent > so > >> it > >> > fails. > >> > Using ignoreInvalidCorrelationKeys does not solve the problem because > the > >> > aggregation is never completed. > >> > Do we need to add a new flag or modify the eagerCheckCompletion > workflow? > >> > Any other clean solution? > >> > > >> > Cheers, > >> > Carlo > >> > > >> > > >> > 2014-06-06 15:04 GMT+02:00 Claus Ibsen <claus.ib...@gmail.com>: > >> > > >> >> Hi > >> >> > >> >> See the aggregator docs > >> >> http://camel.apache.org/aggregator2 > >> >> > >> >> there is an eagerCheckCompletion option > >> >> > >> >> On Fri, Jun 6, 2014 at 2:46 PM, carlo cancellieri > >> >> <c.cancelli...@proximainformatica.com> wrote: > >> >> > Hi list, > >> >> > I'm using the following aggregation: > >> >> > > >> >> > > >> >> > <route> > >> >> > <from uri="seda:aggregation" /> > >> >> > <!-- aggregate using our strategy and leveldb repo --> > >> >> > <aggregate strategyRef="rowAggregationStrategy" > >> >> > aggregationRepositoryRef="aggregationRepository" > >> >> > completionFromBatchConsumer="false"> > >> >> > <!-- correlate by header with the key id --> > >> >> > <correlationExpression> > >> >> > <header>aggrId</header> > >> >> > </correlationExpression> > >> >> > > >> >> > <completionPredicate> > >> >> > <simple>${in.header.complId} == 'END_${exchangeId}'</simple> > >> >> > </completionPredicate> > >> >> > <!-- send aggregated messages to the mock endpoint --> > >> >> > <to uri="seda:marshaller" /> > >> >> > </aggregate> > >> >> > </route> > >> >> > > >> >> > When the aggregation may be concluded I send an empty message with > the > >> >> > 'complId' set to the expected value but currently I get: > >> >> > > >> >> > org.apache.camel.CamelExchangeException: Invalid correlation key. > >> >> > Exchange[test_complete.csv] > >> >> > at > >> >> > > >> >> > >> > org.apache.camel.processor.aggregate.AggregateProcessor.doProcess(AggregateProcessor.java:204) > >> >> > at > >> >> > > >> >> > >> > org.apache.camel.processor.aggregate.AggregateProcessor.process(AggregateProcessor.java:179) > >> >> > at > >> >> > > >> >> > >> > org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:72) > >> >> > > >> >> > The question is why the completionPredicate is evaluated after the > >> >> > aggregation? > >> >> > At this time I've no 'aggrId' to use (this is only a fake message > >> used as > >> >> > event). > >> >> > A possible solution is adding a fake aggrId but I wonder what > could be > >> >> the > >> >> > right way to solve this case. > >> >> > I've already tested completionFromBatchConsumer the with no > success. > >> >> > > >> >> > -- > >> >> > Dott. Carlo Cancellieri > >> >> > *skype*: ccancellieri > >> >> > *Twitter*: @cancellieric > >> >> > *LinkedIn*: http://it.linkedin.com/in/ccancellieri/ > >> >> > >> >> > >> >> > >> >> -- > >> >> Claus Ibsen > >> >> ----------------- > >> >> Red Hat, Inc. > >> >> Email: cib...@redhat.com > >> >> Twitter: davsclaus > >> >> Blog: http://davsclaus.com > >> >> Author of Camel in Action: http://www.manning.com/ibsen > >> >> hawtio: http://hawt.io/ > >> >> fabric8: http://fabric8.io/ > >> >> > >> > > >> > > >> > > >> > -- > >> > Dott. Carlo Cancellieri > >> > *skype*: ccancellieri > >> > *Twitter*: @cancellieric > >> > *LinkedIn*: http://it.linkedin.com/in/ccancellieri/ > >> > >> > >> > >> -- > >> Claus Ibsen > >> ----------------- > >> Red Hat, Inc. > >> Email: cib...@redhat.com > >> Twitter: davsclaus > >> Blog: http://davsclaus.com > >> Author of Camel in Action: http://www.manning.com/ibsen > >> hawtio: http://hawt.io/ > >> fabric8: http://fabric8.io/ > >> > > > > > > > > -- > > Dott. Carlo Cancellieri > > *skype*: ccancellieri > > *Twitter*: @cancellieric > > *LinkedIn*: http://it.linkedin.com/in/ccancellieri/ > > > > -- > Claus Ibsen > ----------------- > Red Hat, Inc. > Email: cib...@redhat.com > Twitter: davsclaus > Blog: http://davsclaus.com > Author of Camel in Action: http://www.manning.com/ibsen > hawtio: http://hawt.io/ > fabric8: http://fabric8.io/ > -- Dott. Carlo Cancellieri *skype*: ccancellieri *Twitter*: @cancellieric *LinkedIn*: http://it.linkedin.com/in/ccancellieri/