In Java DSL you can do like this from("direct:a")
.recipientList().simple("activemq:receiving:${header.app}").to("mock:xxx"); Then there is no issue with RecipientListDefinition as that type is not in use. On Wed, Jul 27, 2011 at 9:08 AM, Blair <blair.nils...@gmail.com> 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 :) > > > -- > View this message in context: > http://camel.465427.n5.nabble.com/anyone-else-want-changes-to-the-DSL-tp4637768p4637768.html > Sent from the Camel - Users mailing list archive at Nabble.com. > -- Claus Ibsen ----------------- FuseSource Email: cib...@fusesource.com Web: http://fusesource.com Twitter: davsclaus, fusenews Blog: http://davsclaus.blogspot.com/ Author of Camel in Action: http://www.manning.com/ibsen/