FAQ
Hi,

I've spent several hours trying to find out what I suspect to be a trivial
thing.

I want to access the value of a header on the exchange to allow creation of
dynamic URI to my enrich.

This is how I set the header:

*.setHeader(Exchange.**HTTP_URI, simple(
"http4://localhost:9984/products/${header.EAN}"))*

This will override the URI and gives me a dynamic URI when using:

*.to("http4://localhost:9984/")*

But now I would like to use:

*.enrich( "dynamic-uri-from-header", **new** SomeAggregationStrategy())*

I just can't seem to get how to access the headervalue as a String.

Trying for instance with header(Exchange.HTTP_URI). or with converting a
"simple" expression into a string value.

What am I missing?

--
Brgds, Magnus Palmér
+46736845680

Search Discussions

  • Claus Ibsen at Apr 29, 2011 at 5:59 am

    2011/4/28 Magnus Palmér <magnus.palmer.work@gmail.com>:
    Hi,

    I've spent several hours trying to find out what I suspect to be a trivial
    thing.

    I want to access the value of a header on the exchange to allow creation of
    dynamic URI to my enrich.

    This is how I set the header:

    *.setHeader(Exchange.**HTTP_URI, simple(
    "http4://localhost:9984/products/${header.EAN}"))*

    This will override the URI and gives me a dynamic URI when using:

    *.to("http4://localhost:9984/")*

    But now I would like to use:

    *.enrich( "dynamic-uri-from-header", **new** SomeAggregationStrategy())*

    I just can't seem to get how to access the headervalue as a String.

    Trying for instance with header(Exchange.HTTP_URI). or with converting a
    "simple" expression into a string value.

    What am I missing?
    Reading the information about the EIP on the website
    http://camel.apache.org/content-enricher.html

    There is a red warning box which explains about this.
    As well as page 72 in the Camel in Action book.

    --
    Brgds, Magnus Palmér
    +46736845680


    --
    Claus Ibsen
    -----------------
    FuseSource
    Email: cibsen@fusesource.com
    Web: http://fusesource.com
    CamelOne 2011: http://fusesource.com/camelone2011/
    Twitter: davsclaus
    Blog: http://davsclaus.blogspot.com/
    Author of Camel in Action: http://www.manning.com/ibsen/
  • Claus Ibsen at Apr 29, 2011 at 6:01 am

    On Fri, Apr 29, 2011 at 7:58 AM, Claus Ibsen wrote:
    2011/4/28 Magnus Palmér <magnus.palmer.work@gmail.com>:
    Hi,

    I've spent several hours trying to find out what I suspect to be a trivial
    thing.

    I want to access the value of a header on the exchange to allow creation of
    dynamic URI to my enrich.

    This is how I set the header:

    *.setHeader(Exchange.**HTTP_URI, simple(
    "http4://localhost:9984/products/${header.EAN}"))*

    This will override the URI and gives me a dynamic URI when using:

    *.to("http4://localhost:9984/")*

    But now I would like to use:

    *.enrich( "dynamic-uri-from-header", **new** SomeAggregationStrategy())*

    I just can't seem to get how to access the headervalue as a String.

    Trying for instance with header(Exchange.HTTP_URI). or with converting a
    "simple" expression into a string value.

    What am I missing?
    Reading the information about the EIP on the website
    http://camel.apache.org/content-enricher.html

    There is a red warning box which explains about this.
    As well as page 72 in the Camel in Action book.
    Instead of enrich you can use recipient list EIP as it allows you to
    use a dynamic uri and also aggregate at the same time.

    BTW: There is a JIRA ticket to improve the Content Enricher EIP to
    allow to access data from the current Exchange so it can use dynamic
    URIs and whatnot. But the problem is currently due the PollingConsumer
    API that dont offer options and thus we need to either adjust this API
    or come up with some other means.

    Voting on JIRA tickets you would like to see resolved is a way for the
    community to help us prioritize the tickets.

    --
    Brgds, Magnus Palmér
    +46736845680


    --
    Claus Ibsen
    -----------------
    FuseSource
    Email: cibsen@fusesource.com
    Web: http://fusesource.com
    CamelOne 2011: http://fusesource.com/camelone2011/
    Twitter: davsclaus
    Blog: http://davsclaus.blogspot.com/
    Author of Camel in Action: http://www.manning.com/ibsen/


    --
    Claus Ibsen
    -----------------
    FuseSource
    Email: cibsen@fusesource.com
    Web: http://fusesource.com
    CamelOne 2011: http://fusesource.com/camelone2011/
    Twitter: davsclaus
    Blog: http://davsclaus.blogspot.com/
    Author of Camel in Action: http://www.manning.com/ibsen/
  • Magnus Palmér at Apr 29, 2011 at 6:33 am
    Thanks, didn't think it was related to the enrich itself so missed that.
    Quite a big red box in the book.

    recipient list with aggregationstrategy did the trick.

    I'll have a look at JIRA.

    2011/4/29 Claus Ibsen <claus.ibsen@gmail.com>
    On Fri, Apr 29, 2011 at 7:58 AM, Claus Ibsen wrote:
    2011/4/28 Magnus Palmér <magnus.palmer.work@gmail.com>:
    Hi,

    I've spent several hours trying to find out what I suspect to be a
    trivial
    thing.

    I want to access the value of a header on the exchange to allow creation
    of
    dynamic URI to my enrich.

    This is how I set the header:

    *.setHeader(Exchange.**HTTP_URI, simple(
    "http4://localhost:9984/products/${header.EAN}"))*

    This will override the URI and gives me a dynamic URI when using:

    *.to("http4://localhost:9984/")*

    But now I would like to use:

    *.enrich( "dynamic-uri-from-header", **new** SomeAggregationStrategy())*

    I just can't seem to get how to access the headervalue as a String.

    Trying for instance with header(Exchange.HTTP_URI). or with converting a
    "simple" expression into a string value.

    What am I missing?
    Reading the information about the EIP on the website
    http://camel.apache.org/content-enricher.html

    There is a red warning box which explains about this.
    As well as page 72 in the Camel in Action book.
    Instead of enrich you can use recipient list EIP as it allows you to
    use a dynamic uri and also aggregate at the same time.

    BTW: There is a JIRA ticket to improve the Content Enricher EIP to
    allow to access data from the current Exchange so it can use dynamic
    URIs and whatnot. But the problem is currently due the PollingConsumer
    API that dont offer options and thus we need to either adjust this API
    or come up with some other means.

    Voting on JIRA tickets you would like to see resolved is a way for the
    community to help us prioritize the tickets.

    --
    Brgds, Magnus Palmér
    +46736845680


    --
    Claus Ibsen
    -----------------
    FuseSource
    Email: cibsen@fusesource.com
    Web: http://fusesource.com
    CamelOne 2011: http://fusesource.com/camelone2011/
    Twitter: davsclaus
    Blog: http://davsclaus.blogspot.com/
    Author of Camel in Action: http://www.manning.com/ibsen/


    --
    Claus Ibsen
    -----------------
    FuseSource
    Email: cibsen@fusesource.com
    Web: http://fusesource.com
    CamelOne 2011: http://fusesource.com/camelone2011/
    Twitter: davsclaus
    Blog: http://davsclaus.blogspot.com/
    Author of Camel in Action: http://www.manning.com/ibsen/


    --
    --
    Brgds, Magnus Palmér
    +46736845680

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupusers @
categoriescamel
postedApr 28, '11 at 8:47p
activeApr 29, '11 at 6:33a
posts4
users2
websitecamel.apache.org

2 users in discussion

Claus Ibsen: 2 posts Magnus Palmér: 2 posts

People

Translate

site design / logo © 2022 Grokbase