On Tue, May 29, 2012 at 10:39 PM, erstanl <[email protected]> wrote: > All, I have a camel servlet that is consuming an XML stream. I currently have > it splitting that stream successfully. The problem is that I need to split > it multiple times. There are 2 sections in the stream that I am interested > in. Once I have those split out, I intend to forward them as JMS messages > via HornetQ. Right now just to get it working im trying to send the output > of the split to file. This is my current config. It will only split using > the first split tag. > > <route> > <from uri="servlet:///input" /> > <split streaming="true"> > <tokenize token="mules" xml="true" /> > <to uri="file://c:/dev/servlet-output-mules" /> > </split> > <split streaming="true"> > <tokenize token="donkeys" xml="true" /> > <to uri="file://c:/dev/servlet-output-donkeys" > /> > </split> > </route> > > Is there a way to split the stream multiple times without loading the entire > document into memory? Thanks for any help. I am using Camel 2.9.2. >
Do you really have such big messages that they cannot be loaded into memory once? If you convert the message to a String, then you can multicast and use 2 splitters. If not then you can split it once, and then implement logic that splits into both donkeys and mules. And then do a content based router, to route donkeys and mules differently. Alternatively you can store it in a temporary off memory store such as a disk, and then split it from disk, which can be read 2+ times etc. > -Ry > > -- > View this message in context: > http://camel.465427.n5.nabble.com/Splitting-a-stream-from-a-servlet-tp5713713.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.com Author of Camel in Action: http://www.manning.com/ibsen
