camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Claus Ibsen <claus.ib...@gmail.com>
Subject Re: AggregationStrategy and completionPredicate
Date Fri, 06 Jun 2014 15:12:56 GMT
On Fri, Jun 6, 2014 at 5:01 PM, carlo cancellieri
<c.cancellieri@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.cancellieri@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.ibsen@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.cancellieri@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: cibsen@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: cibsen@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: cibsen@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/

Mime
View raw message