Hi You can look at this example instead from the same wiki page - Using a Pojo to do the splitting Then in the POJO, you can return an Iterator instead of a List, in case you want to do the splitting on-demand in a streaming fashion. This avoids preparing all the messages up-front, and thus do not eat up memory.
For example its the same principle used by the splitting big XML files, we added in Camel 2.9, using the tokenizers. http://davsclaus.blogspot.com/2011/11/splitting-big-xml-files-with-apache.html Or the stax component http://davsclaus.blogspot.com/2011/11/splitting-big-xml-files-with-apache_24.html On Thu, Dec 15, 2011 at 9:23 PM, marks1900 <[email protected]> wrote: > On the following page: http://camel.apache.org/splitter.html , there is an > excerpt that I have questions about. > > ++ Excerpt - Start ++ > > import static org.apache.camel.builder.ExpressionBuilder.beanExpression; > from("direct:streaming") > .split(beanExpression(new MyCustomIteratorFactory(), "iterator")) > .streaming().to("activemq:my.parts") > > ++ Excerpt - End ++ > > Can someone provided me with same code for the MyCustomIteratorFactory > class? > > Basically I have one huge file, that I want to split into many jms messages. > > The following is an outline of my current thoughts... > > public void configure() throws Exception > { > from( > "file://file-item-list/general?initialDelay=1000&delay=5000&delete=true" > ) > .transacted( "PROPAGATION_REQUIRED" ) > .split(ExpressionBuilder.beanExpression(new > MyCustomFileChunkIterator(), "iterator")) // split big file of items into > smaller chunks > .streaming() > .process( generalPreprocessorBean ) // Reads in a smaller list > and outputs a request to process the smaller subset of items > .to("activemq:queue:file-item-sublist-request"); > } > > > > * Unfortunately I cannot subscribe to the mailing list as, so if someone can > bounce this request to the mailing list that would be great. > > <[email protected]>: > Remote host said: 552 spam score (5.8) exceeded threshold > (FREEMAIL_FORGED_REPLYTO,HTML_MESSAGE,RCVD_IN_DNSWL_NONE,REPTO_QUOTE_YAHOO,SPF_NEUTRAL > ) [BODY] > > > > > -- > View this message in context: > http://camel.465427.n5.nabble.com/split-beanExpression-new-MyCustomIteratorFactory-iterator-tp5078583p5078583.html > Sent from the Camel - Users mailing list archive at Nabble.com. -- Claus Ibsen ----------------- FuseSource Email: [email protected] Web: http://fusesource.com Twitter: davsclaus, fusenews Blog: http://davsclaus.blogspot.com/ Author of Camel in Action: http://www.manning.com/ibsen/
