camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Claus Ibsen <>
Subject Re: Splitting a stream from a servlet
Date Sat, 02 Jun 2012 17:36:31 GMT
On Tue, May 29, 2012 at 10:39 PM, erstanl <> 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:
> Sent from the Camel - Users mailing list archive at

Claus Ibsen
Twitter: davsclaus, fusenews
Author of Camel in Action:

View raw message