I want to have
_ from( A ) _ .split()... _ .choice() //Choice 1 _ .when( predicate ) _ .process() _ .choice() // Choice 2 _ .when( x ) _ .to( X ) _ .otherwise() _ .to( Y ) _ .end() // to terminate inner choice _ .endchoice() // tell camel we're back in the outer-choice - gets exception _ .otherwise() // Choice 1 _ .to( Z ) _ .end()
but I get a runtime exception in endChoice ()
java.lang.ClassCastException: org.apache.camel.model.SplitDefinition cannot be cast to org.apache.camel.model.ChoiceDefinition
I get a compile time error without it
I suspect that end () completes the inner and outer selections, I just want it to complete the inner one.
without putting at the end of (), it treats the second otherwise () as an extension of the internal selection. It is not so.
I found a workaround by putting the second option in the subpath and "direct: SUB_ROUTE" in it, but I would prefer to use the clearer structure described above if I could. Is there a way to make choices in options, or is it just a limitation of Java DSL?
user1743310
source share