Claus Ibsen-2 wrote:
> 
> On Fri, Jun 12, 2009 at 12:07 PM, ErwinK<[email protected]> 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?
> Hi
> 
> 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:
>> http://www.nabble.com/Custom-AggregationStrategy-needs-specific-headers-tp23996092p23996092.html
>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>
>>
> 
> 
> 
> -- 
> Claus Ibsen
> Apache Camel Committer
> 
> Open Source Integration: http://fusesource.com
> Blog: http://davsclaus.blogspot.com/
> Twitter: http://twitter.com/davsclaus
> 
> 

The problem in this case is that I don't really mind to lose my own headers
when using a default component, but that the headers set by the splitter are
needed in the end for the aggregation. So that means that when you use
default components, you have to write some extra code that ensures that the
headers are still (or again) there just before the aggregation, otherwise it
will just not work.

I think it should definitly be addressed in 2.0, but if it is not to hard,
also in 1.6.x. If there is a ticket I can see if I can send a patch.

Regards,
Erwin

-- 
View this message in context: 
http://www.nabble.com/Custom-AggregationStrategy-needs-specific-headers-tp23996092p23996797.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Reply via email to