Clause,

This is what my route looks like

               from("file:C:/work/esb/filetestpoller/")//large file
exceeding 800M
                .convertBodyTo(InputStream.class)
                .splitter(customsplitter)//custom splitter(injected by spring) 
that
returns a java.util.Collection
                .process(requestprocessor)
                .to("jms:responseoutbox");

I would prefer the custom splitter return java.util.Iterator instead of a
Collection, the reason why I am returning a collection is because if I
return an iterator I get an exception. The reason I am using a custom
splitter is to return a data structure ( a collection)  that gets the data
from a persistent store (much like the claim check pattern) instead of
keeping the data in memory which will crash our system. Please let me know
if there is a better way of dealing with this issue.



Claus Ibsen-2 wrote:
> 
> Hi
> 
> Camel will convert whatever your expression returns to something that
> it iterates.
> For non streams it will walk the list before they are processed, so it
> will know the total size.
> 
> If you have a very large document you can use streaming to split it
> on-the-fly.
> However then the total size is not known.
> 
> 
> 
> On Wed, Apr 8, 2009 at 10:50 PM, javadevel <javadeve...@yahoo.com> wrote:
>>
>> I need to use a splitter expression to split a very large document with
>> rather complex splitting requirement. Based on the documentation provided
>> on
>> the Apache Camel Splitter, I can write a Bean or implement the Expression
>> interface and return  java.util.Collection or java.util.Iterator.
>> However,
>> it only works with collections because the iterator interface does not
>> provide a getSize method the Camel router can use to set the splittersize
>> header. If my observation is correct, please modify the documentation to
>> say
>> it must only return a  java.util.Collection or modify the code so that it
>> supports iterator too. If it supports iterator it will be extremely
>> useful
>> because we may not always know the splittersize especially when the data
>> is
>> huge and passed as an inputstream.
>> --
>> View this message in context:
>> http://www.nabble.com/splitter-expression-tp22959250p22959250.html
>> Sent from the Camel - Users (activemq) 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
> Apache Camel Reference Card:
> http://refcardz.dzone.com/refcardz/enterprise-integration
> 
> 

-- 
View this message in context: 
http://www.nabble.com/splitter-expression-tp22959250p22971404.html
Sent from the Camel - Users (activemq) mailing list archive at Nabble.com.

Reply via email to