You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by "Gershaw, Geoffrey A. " <ge...@credit-suisse.com> on 2017/01/04 23:01:41 UTC
Splitter Question
Hi All,
I am on version 2.17 and am splitting a json document and passing bits of json to a processor. If the processing bean returns null, I want to keep iterating. If the processing bean returns a Widget, I would like to stop iterating and have the old exchange contain the Widget. I believe I need an aggregator to detect when its time to aggregate and to copy the widget from the new exchange to the old exchange.
The below doesn't run. Error is : Definition has no children on Aggregate[true -> []]. I think this is because I don't have any endpoints between aggregate and end.
I'm sure I'm doing something simple wrong. Any advice would be appreciated.
.split().jsonpath("$.[*]")
.bean(WidgetProcessingBean.class)
.aggregate(constant(true), new DummyAggregationStrategy()).eagerCheckCompletion()
.completionPredicate(body().isNotNull()))
.end()
.end()
.choice()
.when(body().isInstanceOf(Widget.class))
.log("Widget found")
.otherwise()
.log("Widget not found")
.end()
Thanks,
Geoff
===============================================================================
Please access the attached hyperlink for an important electronic communications disclaimer:
http://www.credit-suisse.com/legal/en/disclaimer_email_ib.html
===============================================================================
Re: Splitter Question
Posted by Claus Ibsen <cl...@gmail.com>.
Hi
Yeah see the this EIP and the _splitter only_ section
http://camel.apache.org/composed-message-processor.html
On Thu, Jan 5, 2017 at 12:01 AM, Gershaw, Geoffrey A.
<ge...@credit-suisse.com> wrote:
> Hi All,
>
> I am on version 2.17 and am splitting a json document and passing bits of json to a processor. If the processing bean returns null, I want to keep iterating. If the processing bean returns a Widget, I would like to stop iterating and have the old exchange contain the Widget. I believe I need an aggregator to detect when its time to aggregate and to copy the widget from the new exchange to the old exchange.
>
> The below doesn't run. Error is : Definition has no children on Aggregate[true -> []]. I think this is because I don't have any endpoints between aggregate and end.
>
> I'm sure I'm doing something simple wrong. Any advice would be appreciated.
>
>
> .split().jsonpath("$.[*]")
> .bean(WidgetProcessingBean.class)
> .aggregate(constant(true), new DummyAggregationStrategy()).eagerCheckCompletion()
> .completionPredicate(body().isNotNull()))
> .end()
> .end()
> .choice()
> .when(body().isInstanceOf(Widget.class))
> .log("Widget found")
> .otherwise()
> .log("Widget not found")
> .end()
>
> Thanks,
> Geoff
>
> ===============================================================================
> Please access the attached hyperlink for an important electronic communications disclaimer:
> http://www.credit-suisse.com/legal/en/disclaimer_email_ib.html
> ===============================================================================
--
Claus Ibsen
-----------------
http://davsclaus.com @davsclaus
Camel in Action 2: https://www.manning.com/ibsen2