I wanted to replace the usage of new Expression() with an Xpath expression,
but I cannot find the correct syntax to use, so that it will work.
My route is that:
from("activemq:queue:camel.train.plan.queue").
.setHeader("endpointName",
constant("activemq:queue:camel.train.plan.queue.").append(
new XPathBuilder("trainSchedule/destination/[EMAIL PROTECTED]") ))
.recipientList(header("endpointName"));
But what I get here is a queue with my xpath expression as name. I also
tried to use XPathExpression instead of XPathBuilder, but this is not
working either.
Thanks
Robert
-----Ursprüngliche Nachricht-----
Von: Roman Kalukiewicz [mailto:[EMAIL PROTECTED]
Gesendet: Freitag, 28. Dezember 2007 17:05
An: [email protected]
Betreff: Re: XPath splitter again
Notice that the method you are implementing is configure() method - it is
executed ONCE at the very beginning. It is not executed on each message. And
concatenation you use is executed when configure() method is executed - it
is still Java after all.
what you could do is
from("activemq:queue:camel.train.plan.queue.router")
.setHeader("endpointName",
constant("activemq:queue:camel.train.plan.queue.").append(new
Expression() {
public Object evaluate(Exchange exchange) {
return <evaluate your queue name postfix>
}))
.receipentList(header("endpointName"));
}
Maybe instead of using new Expression() it will be enough to evaluate the
value using xpath or el so it will be simpler?
If you have only short list of destinations then maybe filter() is better
for you?
Roman