You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by yuanchen <yu...@yahoo.com> on 2010/11/19 15:25:47 UTC
How to get header/property info out from
sendBodyAndHeader/sendBodyAndProperty
I am trying to use ProducerTemplate.sendBodyAndProperty(endpoint, body,
property, propertyValue) or sendBodyAndHeader(endpoint, body, header,
headerValue) to passing some info in the property/header to endpointUri
(used as file name) defined in CamelContext spring config below. How do I
configure the camel context to get the string value from header/property
passed in sendBodyAndHeader/sendBodyAndProperty?
<camelContext id="camel" xmlns="http://camel.apache.org/schema/spring">
<route>
<from uri="direct:endpoint"/>
<to uri="file:/?fileName=${some string passed from
property/header}"/>
</route>
</camelContext>
Thanks a lot for the help,
YC
--
View this message in context: http://camel.465427.n5.nabble.com/How-to-get-header-property-info-out-from-sendBodyAndHeader-sendBodyAndProperty-tp3272364p3272364.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: How to get header/property info out from sendBodyAndHeader/sendBodyAndProperty
Posted by Claus Ibsen <cl...@gmail.com>.
Hi
Learn the patterns :)
You need to use the recipient list pattern which can act dynamic.
http://camel.apache.org/recipient-list.html
On Fri, Nov 19, 2010 at 3:25 PM, yuanchen <yu...@yahoo.com> wrote:
>
> I am trying to use ProducerTemplate.sendBodyAndProperty(endpoint, body,
> property, propertyValue) or sendBodyAndHeader(endpoint, body, header,
> headerValue) to passing some info in the property/header to endpointUri
> (used as file name) defined in CamelContext spring config below. How do I
> configure the camel context to get the string value from header/property
> passed in sendBodyAndHeader/sendBodyAndProperty?
>
> <camelContext id="camel" xmlns="http://camel.apache.org/schema/spring">
> <route>
> <from uri="direct:endpoint"/>
> <to uri="file:/?fileName=${some string passed from
> property/header}"/>
> </route>
> </camelContext>
>
> Thanks a lot for the help,
> YC
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/How-to-get-header-property-info-out-from-sendBodyAndHeader-sendBodyAndProperty-tp3272364p3272364.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
--
Claus Ibsen
-----------------
FuseSource
Email: cibsen@fusesource.com
Web: http://fusesource.com
Twitter: davsclaus
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/
Re: How to get header/property info out from sendBodyAndHeader/sendBodyAndProperty
Posted by Willem Jiang <wi...@gmail.com>.
Hi,
you don't need to pass that header as the option of the URI.
If you take a look at the File2[1] document, you will find there is a
message header (CamelFileName) can do the job as you want.
[1]http://camel.apache.org/file2.html
On 11/19/10 10:25 PM, yuanchen wrote:
>
> I am trying to use ProducerTemplate.sendBodyAndProperty(endpoint, body,
> property, propertyValue) or sendBodyAndHeader(endpoint, body, header,
> headerValue) to passing some info in the property/header to endpointUri
> (used as file name) defined in CamelContext spring config below. How do I
> configure the camel context to get the string value from header/property
> passed in sendBodyAndHeader/sendBodyAndProperty?
>
> <camelContext id="camel" xmlns="http://camel.apache.org/schema/spring">
> <route>
> <from uri="direct:endpoint"/>
> <to uri="file:/?fileName=${some string passed from
> property/header}"/>
> </route>
> </camelContext>
>
> Thanks a lot for the help,
> YC
>
--
Willem
----------------------------------
FuseSource
Web: http://www.fusesource.com
Blog: http://willemjiang.blogspot.com (English)
http://jnn.javaeye.com (Chinese)
Twitter: willemjiang
Re: How to get header/property info out from sendBodyAndHeader/sendBodyAndProperty
Posted by Claus Ibsen <cl...@gmail.com>.
On Tue, Jan 15, 2013 at 9:59 PM, cgfulton <cg...@gmail.com> wrote:
> How do I configure the camel context to get the string value from
> header/property? In my case I would like to use the exec component and pass
> option values using the header/property.
>
See this FAQ
http://camel.apache.org/how-do-i-use-dynamic-uri-in-to.html
>
>
> <camelContext id="camel" xmlns="http://camel.apache.org/schema/spring">
> <route>
> <from uri="direct:ping" />
> <to uri="exec:ping?args=-c1 ${in.header.host}"/>
> </route>
> <route>
> <from uri="direct:echo" />
> <to uri="exec:ls?args=-c1 ${in.header.dir}"/>
> </route>
> </camelContext>
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/How-to-get-header-property-info-out-from-sendBodyAndHeader-sendBodyAndProperty-tp3272364p5725591.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
--
Claus Ibsen
-----------------
Red Hat, Inc.
FuseSource is now part of Red Hat
Email: cibsen@redhat.com
Web: http://fusesource.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen
Re: How to get header/property info out from
sendBodyAndHeader/sendBodyAndProperty
Posted by cgfulton <cg...@gmail.com>.
How do I configure the camel context to get the string value from
header/property? In my case I would like to use the exec component and pass
option values using the header/property.
<camelContext id="camel" xmlns="http://camel.apache.org/schema/spring">
<route>
<from uri="direct:ping" />
<to uri="exec:ping?args=-c1 ${in.header.host}"/>
</route>
<route>
<from uri="direct:echo" />
<to uri="exec:ls?args=-c1 ${in.header.dir}"/>
</route>
</camelContext>
--
View this message in context: http://camel.465427.n5.nabble.com/How-to-get-header-property-info-out-from-sendBodyAndHeader-sendBodyAndProperty-tp3272364p5725591.html
Sent from the Camel - Users mailing list archive at Nabble.com.