King! 

Glad you figured it out

I tried it but for me it didn’t work, it still produces one exchange per 
“group” not one List with all grouped messages in it…

Quite tricky, this one is…

M

> On 8 Apr 2020, at 12:23, Craig Taylor <ctalk...@ctalkobt.net> wrote:
> 
> Problem solved.  To be a good net-zitizen, this is what I found after
> finding some old source code from when I knew camel better:
> 
> Using .
>   aggregate( simple( "${body.id}"),
> AggregationStrategies.flexible().accumulateInCollection( ArrayList.class))
>   .completionTimeout(5000L)
> allowed me to have a body of List<-type-> being passed along my route.
> 
> I'm not sure why the example Claus posted is working versus using the
> flexible approach / what the GroupedAggregationStrategies are intended to
> be used for.   Documentation there is terse and I'm still not sure as to
> what their actual purpose is.
> 
> Thanks,
> 
> On Wed, Apr 8, 2020 at 6:06 AM Mikael Andersson Wigander <
> mikael.grevs...@gmail.com> wrote:
> 
>> I too have migrated to Camel 3 and I can’t get this to work.
>> 
>> I have tried using a constant(true) but I get only 1 message back instead
>> of 3
>> 
>> Using a unique correlation expression I get as before, 3 different back,
>> not a List of 3
>> 
>> M
>> 
>>> On 4 Apr 2020, at 16:10, Craig Taylor <ctalk...@ctalkobt.net> wrote:
>>> 
>>>>> Are you really sure as its supposed to store a List<Object> that are
>>> the message body.
>>> 
>>> Yes, wanting to accumulate List<Object> over a period of time so before
>>> passing into a "full changes" object so that batching of the request to a
>>> 3rd party api can occur.
>>> 
>>> I'm using Camel 3.1.0, and more detail / output from my route follows
>> (note
>>> - having issues w/ log4j - will look at that after this, first things
>>> first):
>>> 
>>>       from(Routes.InitialRoute)
>>>           .process(
>>>               (Exchange ex) -> { Logger.getLogger().error("****
>> Exchange:
>>> " + ex.getIn().getBody()); }
>>>           )
>>>           .aggregate(simple("${body.id}"),
>>> AggregationStrategies.groupedBody())
>>>               .completionTimeout(5000L)
>>>           .process(
>>>               (Exchange ex) -> { Logger.getLogger().error("****
>>> Exchange2: " + ex.getIn().getBody()); }
>>>           )
>>>           .to(ChangeNotificationRoute.ROUTE_TO_WATERSHED);
>>> 
>>> with an output of :
>>> 
>>> 2020/Apr/04 09:59:03.233 ERROR ....MyChangeRoute.lambda$configure$0: ****
>>> Exchange: {change:'user', id:'ekp000002600', field:'FIELD', new:'1',
>>> old:'null'}
>>> 2020/Apr/04 09:59:08.770 ERROR ....MyChangeRoute.lambda$configure$1: ****
>>> Exchange2: List<Exchange>(1 elements)
>>> 
>>> Note that the Routes.InitialRoute is returning a vm:// endpoint.
>>> 
>>> 
>>> 
>>> On Sat, Apr 4, 2020 at 3:50 AM Claus Ibsen <claus.ib...@gmail.com>
>> wrote:
>>> 
>>>> Hi
>>>> 
>>>> Are you really sure as its supposed to store a List<Object> that are
>>>> the message body.
>>>> But there are however only one unit test for this in camel-jms, so
>>>> lets add one to camel-core.
>>>> 
>>>> On Fri, Apr 3, 2020 at 11:23 PM Craig Taylor <ctalk...@ctalkobt.net>
>>>> wrote:
>>>>> 
>>>>> I'm wanting to accumulate all exchanges matching a correlation
>> expression
>>>>> (id) into a list for a given period of time.  I've looked at the
>>>>> GroupedBodyAggregationStrategy and it returns an Exchange with a body
>> of
>>>>> List<Exchange>'s where I had expect an Exchange with a body of
>>>>> List<Body_type> back.
>>>>> 
>>>>> aggregate(simple("${body.id}"), new GroupedBodyAggregationStrategy())
>>>>>   .completionTimeout(5000L)
>>>>> 
>>>>> I wasn't able to find documentation on the built-in aggregator however,
>>>>> this "sounds" like the right one to use based on naming.  Desperation
>>>> wise,
>>>>> attempting the other Grouped Aggregators didn't yield the solution
>>>> either.
>>>>> 
>>>>> Thanks,
>>>>> --
>>>>> -------------------------------------------
>>>>> Craig Taylor
>>>>> ctalk...@ctalkobt.net
>>>> 
>>>> 
>>>> 
>>>> --
>>>> Claus Ibsen
>>>> -----------------
>>>> http://davsclaus.com @davsclaus
>>>> Camel in Action 2: https://www.manning.com/ibsen2
>>>> 
>>> 
>>> 
>>> --
>>> -------------------------------------------
>>> Craig Taylor
>>> ctalk...@ctalkobt.net
>> 
>> 
> 
> -- 
> -------------------------------------------
> Craig Taylor
> ctalk...@ctalkobt.net

Reply via email to