Hi Claus,

tx for the reply. My use case has been extended a bit. See following snippet ..

<bean id="groupedMessage" 
class="org.apache.camel.processor.aggregate.GroupedMessageAggregationStrategy" 
/>
...
<route id="isp.routes.system.deployment">
...
<split streaming="true" strategyRef="groupedMessage">
        <jsonpath>$.consumer[*]</jsonpath>
        <!-- do something and get an out body -->
</split>
<!-- concatenate all exchange bodies ??? -->

<!-- fails -->
<setBody><simple>${body.lines[0]}</simple></setBody>

I want to process every splitted message and at the end concatenate all out 
message bodies.

I did test the access to the <Exchange>List with OGNL but that fails (last 
line).

Is there a way without Java code to concatenate all message bodies while 
splitting?

Best
- Gerald

P.S. I'd nevertheless suggest to introduce some camel context wide variables 
for the context lifetime. Yes, one may use caching, but such context variables 
would probably extend the capabilities.

> Claus Ibsen <[email protected]> hat am 9. Januar 2020 um 15:28 
> geschrieben:
> 
> 
> Hi
> 
> Ah yeah claim check stores on the exchange, so you would need to use a
> custom aggregation strategy on the splitter. There are built-in in
> Camel such as use-latest you can use.
> 
> org.apache.camel.builder.AggregationStrategies#useLatest
> 
> 
> On Thu, Jan 9, 2020 at 3:24 PM Gerald Kallas <[email protected]> wrote:
> >
> > Hi Claus, tx for the response.
> >
> > I tried the claim check EIP like ..
> >
> > ...
> > <log message="outer body before split loop: ${body}" />
> >
> > <split streaming="true">
> >         <jsonpath>$.consumer[*]</jsonpath>
> >         <setBody><constant>XXX</constant></setBody>
> >         <log message="inner body: ${body}" />
> >         <claimCheck operation="Set" key="AAA" filter="body" />
> > </split>
> >
> > <log message="outer body before claim check: ${body}" />
> > <claimCheck operation="Get" key="AAA" filter="body" />
> > <log message="outer body after claim check: ${body}" />
> > ...
> >
> > but it doesn't seem to work.
> >
> > After the split loop I'm always getting the same body as before the split 
> > loop.
> >
> > Do I something wrong here?
> >
> > Best
> > - Gerald
> >
> > > Claus Ibsen <[email protected]> hat am 9. Januar 2020 um 13:15 
> > > geschrieben:
> > >
> > >
> > > Hi
> > >
> > > You can use claim check EIP or use a custom aggregation strategy with
> > > your splitter to tell Camel what data to merge as the result of the
> > > splitter.
> > >
> > > On Thu, Jan 9, 2020 at 1:01 PM Gerald Kallas <[email protected]> wrote:
> > > >
> > > > Dear community,
> > > >
> > > > I've following snippet
> > > >
> > > > <!-- split array of consumers -->
> > > > <split streaming="true">
> > > > <jsonpath>$.consumer[*]</jsonpath>
> > > > ...
> > > > <setProperty 
> > > > name="consumerComponents"><simple>${in.body}</simple></setProperty>
> > > > </split>
> > > > <!-- log the consumer template snippet -->
> > > > <log message="template snippet: ${exchangeProperty.consumerComponents}" 
> > > > />
> > > >
> > > > As I made the experience the lifetime of an exchange property is 
> > > > limited to inside the split boundaries.
> > > >
> > > > Is there an other way (except a custom aggregation strategy) to define 
> > > > a context wide variable?
> > > >
> > > > Best
> > > > - Gerald
> > >
> > >
> > >
> > > --
> > > Claus Ibsen
> > > -----------------
> > > http://davsclaus.com @davsclaus
> > > Camel in Action 2: https://www.manning.com/ibsen2
> 
> 
> 
> -- 
> Claus Ibsen
> -----------------
> http://davsclaus.com @davsclaus
> Camel in Action 2: https://www.manning.com/ibsen2

Reply via email to