camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Claus Ibsen <>
Subject Re: Custom AggregationStrategy needs specific headers
Date Fri, 12 Jun 2009 10:23:51 GMT
On Fri, Jun 12, 2009 at 12:07 PM, ErwinK<> wrote:
> Hello,
> I am using Camel 1.6.1. With the following route:
> from("timer://timer?period=1000")
> .setBody(constant("select * from table"))
> .to("jdbc:db")
> .splitter(body(List.class), new MyAggregationStrategy())
> .to("some default component uri that doesn't forward headers")
> .end()
> .to("log:log")
> The aggregationstrategy needs org.apache.camel.SplitIndex and
> org.apache.camel.SplitSize but you lose them during the route in the
> splitter part.
> I can work around the problem by saving the headers in an exchange property
> as first step and restore them just before the aggregation, but shouldn't
> the splitter itself store necessary information in a property?

The aggregation strategy interface is a bit low-level as you work
directly on the Exchange object.
Doing this you have to be a bit careful whether you set the aggregated
response on OUT or IN.

If you set it on OUT and you do not copy headers from IN then they are lost.

But you are right we could build in failsafe in Camel to safe the headers.
But another solution would be to use exchange properties instead of
headers, then they are newer lost.

I have been wondering if we should migrate Camel 2.0 to use properties
for such thinks as splitter indes, aggregator index, and what else
Camel decorate an exchange with. It kinda belong there in the first place.

> Regards,
> Erwin
> --
> View this message in context:
> Sent from the Camel - Users mailing list archive at

Claus Ibsen
Apache Camel Committer

Open Source Integration:

View raw message