camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stephen Gargan <steve.gar...@gmail.com>
Subject Re: Request message accessibility/manipulation
Date Thu, 14 Jan 2010 20:31:58 GMT
Hi,

You can use Wiretaps and an aggregator to do what you're suggesting.
At each step that you want an intermediate result to be available,
wiretap it off to an aggregator and set the batch size of the
aggregator accordingly.

from("direct:consumerEndpoint").wireTap("direct:aggregator").to("direct:requestToSomeEndpointTransformer").to(
                    "direct:someEndpoint").to("direct:aggregator");

from("direct:aggregator").aggregate().header("id").batchSize(2).groupExchanges().to("mock:result");

One thing to note is that groupExchanges() will gather up all the
aggregated exchanges and store them in a property in the exchange. You
get at them via

List<Exchange> grouped = e.getProperty(Exchange.GROUPED_EXCHANGE, List.class);

You'll need to write a custom processor (in place of the mock) to
combine/transform them to your liking as before responding. You can
find a bunch of info about aggregators here

http://camel.apache.org/aggregator.html

ste.

On Thu, Jan 14, 2010 at 12:12 AM, lekkie <lekkie.aydot@gmail.com> wrote:
>
> Hi guys,
>
>
> Just a quick one. I have this scenario where I 'd like to manipulate a
> request and some reponse from an endpoint. The flow below describe what I am
> trying to achieve:
>
> <osgi:camelContext xmlns="http://camel.apache.org/schema/spring"
> trace="true">
>    <route>
>      <from uri="nmr:consumerEndpoint"/>
>      <to uri="xslt:requestToSomeEndpoint.xsl"/>
>      <to uri="nmr:someEndpoint"/>
>      <to uri="xslt:requestToAnotherEndpoint.xsl"/>
>      <to uri="nmr:anotherEndpoint"/>
>    </route>
> </camelcontext>
>
> I'd like the transformation (requestToAnotherEndpoint.xsl) to be able to
> access/manipulate the original request message from nmr:consumerEndpoint and
> the response from nmr:someEndpoint in order to product its output.
>
> Is this scenario possible?
>
> --
> View this message in context: http://old.nabble.com/Request-message-accessibility-manipulation-tp27157259p27157259.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
>

Mime
View raw message