You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by suman <pr...@gmail.com> on 2011/11/24 16:10:10 UTC

Dynamic Consumers

Hello All,
I have a question regarding dymaic uri inside toF() DSL
Given below is my route

 from("direct:bootstraproute")                
.setHeader(Exchange.HTTP_METHOD,constant(org.apache.camel.component.http4.HttpMethods.GET))
.toF("https4://myapi.com/%s.json?type=2",header("eventid"))
                .setHeader(CacheConstants.CACHE_OPERATION,
constant(CacheConstants.CACHE_OPERATION_ADD))
                .setHeader(CacheConstants.CACHE_KEY, header("eventid"))
                .to("cache://MyCache");

My problem is inside toF DSL ,header("eventid") is getting evaluated when
the route is started and hence its not finding anything.Instead i want it to
get evaluated when the message arrives.Sorry if my question is silly as iam
quite new to camel.Any help would be appreciated

Thanks



--
View this message in context: http://camel.465427.n5.nabble.com/Dynamic-Consumers-tp5020405p5020405.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Dynamic Consumers

Posted by suman <pr...@gmail.com>.
Thanks Guys.Very Helpful.It worked

Regards


--
View this message in context: http://camel.465427.n5.nabble.com/Dynamic-Consumers-tp5020405p5022891.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Dynamic Consumers

Posted by Willem Jiang <wi...@gmail.com>.
You can take a look at recipient-list which can take the message header 
as a parameter to build up the endpoint uri.

[1]http://camel.apache.org/recipient-list.html

On Thu Nov 24 23:10:10 2011, suman wrote:
> Hello All,
> I have a question regarding dymaic uri inside toF() DSL
> Given below is my route
>
>   from("direct:bootstraproute")
> .setHeader(Exchange.HTTP_METHOD,constant(org.apache.camel.component.http4.HttpMethods.GET))
> .toF("https4://myapi.com/%s.json?type=2",header("eventid"))
>                  .setHeader(CacheConstants.CACHE_OPERATION,
> constant(CacheConstants.CACHE_OPERATION_ADD))
>                  .setHeader(CacheConstants.CACHE_KEY, header("eventid"))
>                  .to("cache://MyCache");
>
> My problem is inside toF DSL ,header("eventid") is getting evaluated when
> the route is started and hence its not finding anything.Instead i want it to
> get evaluated when the message arrives.Sorry if my question is silly as iam
> quite new to camel.Any help would be appreciated
>
> Thanks
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Dynamic-Consumers-tp5020405p5020405.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>



-- 
Willem
----------------------------------
FuseSource
Web: http://www.fusesource.com
Blog:    http://willemjiang.blogspot.com (English)
          http://jnn.javaeye.com (Chinese)
Twitter: willemjiang
Weibo: willemjiang

-- 
Willem
----------------------------------
FuseSource
Web: http://www.fusesource.com
Blog:    http://willemjiang.blogspot.com (English)
          http://jnn.javaeye.com (Chinese)
Twitter: willemjiang
Weibo: willemjiang

Re: Dynamic Consumers

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

See this FAQ
http://camel.apache.org/how-do-i-use-dynamic-uri-in-to.html

On Thu, Nov 24, 2011 at 4:10 PM, suman <pr...@gmail.com> wrote:
> Hello All,
> I have a question regarding dymaic uri inside toF() DSL
> Given below is my route
>
>  from("direct:bootstraproute")
> .setHeader(Exchange.HTTP_METHOD,constant(org.apache.camel.component.http4.HttpMethods.GET))
> .toF("https4://myapi.com/%s.json?type=2",header("eventid"))
>                .setHeader(CacheConstants.CACHE_OPERATION,
> constant(CacheConstants.CACHE_OPERATION_ADD))
>                .setHeader(CacheConstants.CACHE_KEY, header("eventid"))
>                .to("cache://MyCache");
>
> My problem is inside toF DSL ,header("eventid") is getting evaluated when
> the route is started and hence its not finding anything.Instead i want it to
> get evaluated when the message arrives.Sorry if my question is silly as iam
> quite new to camel.Any help would be appreciated
>
> Thanks
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Dynamic-Consumers-tp5020405p5020405.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, fusenews
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/