camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christian Müller <christian.muel...@gmail.com>
Subject Re: Java DSL: do I have to have a child for a split()?
Date Sat, 12 Oct 2013 13:31:31 GMT
Your route is the following (I formatted it a bit):
choice()
  .when(...).bean(...)
    .split().method(splitBean, "splitMethod")
  .endChoice()
  .otherwise()
    .bean(...);

When your write "I just want the results of the split() to be forwarded
down the route", how do you do this without a processor/bean/endpoint in
your route between the split and endChoice?

And by the way, instead of
.process(new Processor() { public void process(Exchange e) { /* no-op */ }})

you could use
to("bean:MyNoopProcessor")

and provide a MyNoopProcessor as regular class. It's a bit less ugly IMO.
;-)

Best,

Christian
-----------------

Software Integration Specialist

Apache Member
V.P. Apache Camel | Apache Camel PMC Member | Apache Camel committer
Apache Incubator PMC Member

https://www.linkedin.com/pub/christian-mueller/11/551/642


On Fri, Oct 11, 2013 at 9:58 PM, Keith Freeman <8forty@gmail.com> wrote:

> My route is built in parts from different spots in my code, and at one
> point I do a split:
>
>     choice().when(...).bean(...).**split().method(splitBean,
> "splitMethod").endChoice().**otherwise().bean(...);
>
> This results in a "IllegalArgumentException: Definition has no children on
> Split...".
>
> But at this point in the code I don't know what's going to be added to the
> route, I just want the results of the split() to be forwarded down the
> route.  I currently accomplish this by sticking a no-op processor into the
> route:
>
>     ...split().method(...).**process(new Processor() { public void
> process(Exchange e) { /* no-op */ }}).endChoice()...
>
> Which works fine, but do I really have to do this (it seems kind of ugly
> and inefficient)?  Is there something better as a Camel coding idiom that's
> maybe more efficient?
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message