You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by sushil_vsk5 <su...@yahoo.co.in> on 2012/07/15 11:42:49 UTC

Accessing Number of Splits after the Splitter has done its job

Hello,
I have a route which splits a large file into small chunks in a streaming
mode based on number of lines. Hence, I wont know upfront as to how many
splits shall be done. After the splitting is done, I use the .end() to
continue processing in my route and want to know how many splits were done
and this I would be using in subsequent processing. 
Unfortunately, I am not able to access the property CamelSplitSize as I
always get the original exchange back after my splitting is done. Is there a
way to determine the number of splits after the Splitter ends?
Regards,
Sushil 

--
View this message in context: http://camel.465427.n5.nabble.com/Accessing-Number-of-Splits-after-the-Splitter-has-done-its-job-tp5716052.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Accessing Number of Splits after the Splitter has done its job

Posted by Christian Müller <ch...@gmail.com>.
Yes, provide your own AggregationStrategy. Look for the section "What the
Splitter returns" and "Specifying a custom aggregation strategy" in [1].

I would suggest something like this:
Check the new exchange whether it has the exchange property
"CamelSplitSize".
If it has, set this exchange property in the old exchange.
Return the old exchange.

[1] http://camel.apache.org/splitter.html

Best,
Christian

On Sun, Jul 15, 2012 at 11:42 AM, sushil_vsk5 <su...@yahoo.co.in>wrote:

> Hello,
> I have a route which splits a large file into small chunks in a streaming
> mode based on number of lines. Hence, I wont know upfront as to how many
> splits shall be done. After the splitting is done, I use the .end() to
> continue processing in my route and want to know how many splits were done
> and this I would be using in subsequent processing.
> Unfortunately, I am not able to access the property CamelSplitSize as I
> always get the original exchange back after my splitting is done. Is there
> a
> way to determine the number of splits after the Splitter ends?
> Regards,
> Sushil
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/Accessing-Number-of-Splits-after-the-Splitter-has-done-its-job-tp5716052.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>