You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Robert Dare <ro...@gmail.com> on 2011/08/19 16:25:13 UTC
POJO Routing
Hi Everyone,
I have not been able to find any documentation or examples on using the
"<choice>" elements with pojo based routing.
I am using the Spring XML Extensions to define a route. I can not figure
out how to to test the body with a "<when>" structure. Using the "<xpath>"
element is obviously wrong since the message is a pojo and not
org.w3c.dom.Node.
Is there any way to this with the Spring XML?
I have tried adding Headers in my producer:
producer.sendBodyAndHeader(body, "MyHeader", "SuperHeader");
...but I have not been able to retrieve those headers in the XML route.
Thanks in advance,
Rob
Re: POJO Routing
Posted by Robert Dare <ro...@gmail.com>.
Thank you so much Claus!
That did the trick. Simple was exactly what I was looking for!
On Fri, Aug 19, 2011 at 10:49 AM, Claus Ibsen <cl...@gmail.com> wrote:
> On Fri, Aug 19, 2011 at 4:25 PM, Robert Dare <ro...@gmail.com>
> wrote:
> > Hi Everyone,
> >
> > I have not been able to find any documentation or examples on using the
> > "<choice>" elements with pojo based routing.
> >
> > I am using the Spring XML Extensions to define a route. I can not figure
> > out how to to test the body with a "<when>" structure. Using the
> "<xpath>"
> > element is obviously wrong since the message is a pojo and not
> > org.w3c.dom.Node.
> >
> > Is there any way to this with the Spring XML?
> >
> > I have tried adding Headers in my producer:
> >
> > producer.sendBodyAndHeader(body, "MyHeader", "SuperHeader");
> >
> > ...but I have not been able to retrieve those headers in the XML route.
> >
>
> You can use any of the scripting languages.
> http://camel.apache.org/languages.html
>
> However I suggest to start look at the built in language named Simple
> http://camel.apache.org/simple
>
> Then its a matter of
>
> <when>
> <simple>${header.MyHeader}} == 'SuperHeader'</simple>
> ...
> </when>
>
> Mind that you must have spaces around the == operator. In fact all the
> operators supported by Simple.
>
>
>
>
> > Thanks in advance,
> >
> > Rob
> >
>
>
>
> --
> Claus Ibsen
> -----------------
> FuseSource
> Email: cibsen@fusesource.com
> Web: http://fusesource.com
> Twitter: davsclaus, fusenews
> Blog: http://davsclaus.blogspot.com/
> Author of Camel in Action: http://www.manning.com/ibsen/
>
Re: POJO Routing
Posted by Claus Ibsen <cl...@gmail.com>.
On Fri, Aug 19, 2011 at 4:25 PM, Robert Dare <ro...@gmail.com> wrote:
> Hi Everyone,
>
> I have not been able to find any documentation or examples on using the
> "<choice>" elements with pojo based routing.
>
> I am using the Spring XML Extensions to define a route. I can not figure
> out how to to test the body with a "<when>" structure. Using the "<xpath>"
> element is obviously wrong since the message is a pojo and not
> org.w3c.dom.Node.
>
> Is there any way to this with the Spring XML?
>
> I have tried adding Headers in my producer:
>
> producer.sendBodyAndHeader(body, "MyHeader", "SuperHeader");
>
> ...but I have not been able to retrieve those headers in the XML route.
>
You can use any of the scripting languages.
http://camel.apache.org/languages.html
However I suggest to start look at the built in language named Simple
http://camel.apache.org/simple
Then its a matter of
<when>
<simple>${header.MyHeader}} == 'SuperHeader'</simple>
...
</when>
Mind that you must have spaces around the == operator. In fact all the
operators supported by Simple.
> Thanks in advance,
>
> Rob
>
--
Claus Ibsen
-----------------
FuseSource
Email: cibsen@fusesource.com
Web: http://fusesource.com
Twitter: davsclaus, fusenews
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/