Consider the following route:

from("direct:a")
    .choice()
        .when(simple("${header.foo} == 'bar'"))
            .to("direct:b")
        .when(simple("${header.foo} == 'cheese'"))
            .to("direct:c")
        .otherwise()
            .to("direct:d");

I like to use such choice in a route template. The thing is that I
don't know how many

when statements I need (Between 1 to n when statements). I also don't
know if the otherwise is

needed or not. I don't know, because this is based on user input.

It's impossible to write a route template for every possibility. Is there a way

to use route templates with the use case?

Alternatively I could generate an XML route, but I would rather avoid
that (as I just switched

to route template written with the Java DSL).


Raymond

Reply via email to