FAQ
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.

Search Discussions

  • Claus Ibsen at Nov 25, 2011 at 8:22 am
    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 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/
  • Willem Jiang at Nov 25, 2011 at 1:02 pm
    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
  • Suman at Nov 25, 2011 at 2:32 pm
    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.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupusers @
categoriescamel
postedNov 24, '11 at 3:10p
activeNov 25, '11 at 2:32p
posts4
users3
websitecamel.apache.org

People

Translate

site design / logo © 2022 Grokbase