Blair, see this JIRA for a similar discussion on this... https://issues.apache.org/jira/browse/CAMEL-4226
Blair wrote: > > Hi all, I'd like to add expressions to .to in the DSL... this is why.... > > My code is littered with > > .recipientList(constant("activemq:receiving:").append(header("app")) > > Because I am wanting to send the message to an endpoint that we define in > an expression. (mostly queues) > however... it is a single endpoint, and will only ever be a single > endpoint... I would greatly prefer to be able to use > > .to(constant("activemq:receiving:").append(header("app")) > > just for clarity if nothing else > > The other thing with using .recipientList(Expression) is that you can't > use it in a where clause if you are going to continue with the clause.... > since it returns RecipientListDefinition<Type> where to be in a choice > statement requires a ChoiceDefinition... > > so we end up with code that looks like... > > ... beginning of route here.... > .choice() > .when(header("statusId").isNotEqualTo("")) > .to("direct:receipting") > .otherwise() > .to("direct:receiving") > .end(); > > > from("direct:receipting").routeId("receiptingRestService").recipientList(constant("activemq:receipting:").append(header("app"))); > // queue for each app so one customer service can't interfere with > another... > > from("direct:receiving").routeId("receivingRestService").recipientList(constant("activemq:receiving:").append(header("app"))); > // queue for each app so one customer service can't interfere with > another... > > > > where what I would like to say is.... > .when(header("statusId").isNotEqualTo("")) // we have a > receipt... > > .to(constant("activemq:receipting:").append(header("app"))) > .otherwise() // it must be a message to be passed back... > > .to(constant("activemq:receiving:").append(header("app"))) > .end(); > > I'm happy to make the changes and submit a patch if that helps :) > ----- Ben O'Day IT Consultant -http://consulting-notes.com -- View this message in context: http://camel.465427.n5.nabble.com/anyone-else-want-changes-to-the-DSL-tp4637768p4643998.html Sent from the Camel - Users mailing list archive at Nabble.com.