camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Claus Ibsen <claus.ib...@gmail.com>
Subject Re: pollEnrich dynamic endpoint + Aggregation
Date Thu, 07 Jan 2016 13:32:54 GMT
Just do

pollEnrich("http4://localhost:8080/serviceurl/${in.header.parametervalue}", xxx)

Or maybe

pollEnrich(simple("xxx"), xxx)


On Thu, Jan 7, 2016 at 2:29 PM, Diether <diether.wuyts@optis.be> wrote:
> Since Camel 2.16 it is apparently possible to have dynamic endpoints when
> using pollEnrich, which is a great feature.
> But I'm struggling to use it in combination with an AggregationStrategy.
>
> My usecase is as follows:
> - my route picks up some data and stores it as a pojo on the Exchange.
> - This pojo needs to update some values based on a couple webservice calls
> (REST GET, returns JSON).
> - Parameters of the webservice are current values of the pojo
> - Further processing is required with this complete & updated pojo.
>
> So basically it seems like the pollEnrich is the EIP I can/need to use.
>
> Something like this works (using a fixed value as parameter):
> .pollEnrich("http4://localhost:8080/serviceurl/parametervalue",
> myEnrichAggregator).process(.....)
> Exchange enters my aggregator and I can get data from the response and
> update my original POJO.
>
> But the 'parametervalue' needs to be dynamic.
> So if I understand correctly I need to use something like this now:
> .pollEnrich().simple("http4://localhost:8080/serviceurl/${in.header.parametervalue}")
> But how can I use the aggregationstrategy with this?
>
> Something like this does not compile:
> .pollEnrich().simple("http4://localhost:8080/serviceurl/${in.header.parametervalue}").aggregate(myEnrichAggregator).process(...)
>
>
> Ofcourse I can temporarly store my pojo on the headers, use a .toD, get the
> POJO back from the headers and udpate it with the service response from the
> body.
> But it seems like the pollEnrich is a more correct way of doing this...
>
>
> Also, when I get the response in my AggregationStrategy it is an
> InputStream.
> Is there a way to convert it to String/another POJO before entering the
> AggregationStrategy?
> I could simply confert the Stream to a String and then map it (using
> Jackson) to an object, but it would be nice if I could use the
> .convertBody(..) for this.
>
>
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/pollEnrich-dynamic-endpoint-Aggregation-tp5775972.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
http://davsclaus.com @davsclaus
Camel in Action 2: https://www.manning.com/ibsen2

Mime
View raw message