On Tue, 2009-10-13 at 06:13 +0200, Claus Ibsen wrote:
> On Mon, Oct 12, 2009 at 10:39 PM, Dragisa Krsmanovic
> <[email protected]> wrote:
> > I am trying to do something like:
> >
> > from("activemq:plos.pmc")
> > .to("rnc:pmc-message.rnc")
> > .setHeader(DOI).xpath("/ambraMessage/doi/text()", String.class)
> >
> > .setHeader(Exchange.FILE_NAME).xpath("/ambraMessage/archive/text()",String.class)
> > ...
> >
> > But it doesn't allow me to add any setHeader methods
> > after .to("rnc:...") I want to validate a message before I try to
> > extract Xpath and I have an onException handler to catch
> > ValidationException.
> >
> > What am I doing wrong ?
> >
>
> What do you mean by doesnt allow me to?
>
> You should be able to do that. Are you sure an exception is not occurring?
> You can use the tracer to see how the message is routed
> http://camel.apache.org/tracer
Sorry, I meant to say it doesn't compile.
This route will not compile on Camel 2.0.0 or latest 2.1-SNAPSHOT:
from("activemq:plos.pmc")
.to("rnc:pmc-message.rnc")
.setHeader(DOI).xpath("/ambraMessage/doi/text()", String.class)
.setHeader(Exchange.FILE_NAME).xpath("/ambraMessage/archive/text()",String.class)
.setHeader("to").xpath("/ambraMessage/pmc/mailto/text()",String.class)
.setHeader("CC").xpath("/ambraMessage/pmc/mailtoCC/text()",String.class)
.setHeader("from").xpath("/ambraMessage/pmc/mailtoSender/text()",String.class)
.to("mock:end");
--
Dragisa Krsmanovic
Java Developer
Public Library of Science
http://www.plos.org