First, yes, I have searched and, yes, I have read the same Apache document every one points to. :-) I think there is a bit of confusion and I think I know an answer, so let me
Coming late in the game, but might help.
Nested choice definitions work just fine with Camel. Only your terminators are wrong:
.endChoice()
--> to close a "when" predicate.end()
--> to close the entire "choice" blockI know, the syntax is a bit confusing.
So in your case:
.choice()
.when(X1)
// do stuff
.choice()
.when(Y)
//do more stuff
.endChoice() // close Y condition
.end() // close inner choice block
.endChoice() // close X1 condition
.when(X2)
// do other stuff
.endChoice() // close X2 condition
.otherwise()
// default case
.endChoice() // close default condition
.end()
In practice, you don't have to close all when
predicates, only for multiple child routings. In my humble opinion, being super meticulous with the indentation helps a lot.