I have used a dynamic router (https://camel.apache.org/components/3.18.x/eips/dynamicRouter-eip.html) for this with rules loaded from a properties file. A check on when the file was last modified told the router to update itself. Each line of the properties file is your next route e.g.
bar=direct:b cheese=direct:c otherwise=direct:d Nick -----Original Message----- From: ski n <raymondmees...@gmail.com> Sent: 10 October 2022 20:08 To: users@camel.apache.org Subject: Choice in a route template 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