camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From _Jens <>
Subject StreamCaching in Camel 1.6
Date Tue, 03 Mar 2009 09:59:02 GMT


I have run into a problem with stream caching in Camel 1.6. I have a route
that reads data via streaming from an Http request. In some cases this can
be a large amount of data, so I cannot stream the data completely into
memory. I wrote this little test to demonstrate my problem:

    public void testUploadFailsForHugeFile() throws Exception {        
        CamelContext context = new DefaultCamelContext();
        context.addRoutes(new RouteBuilder() {
            public void configure() throws Exception {
                    .process(new Processor() {
                        public void process(Exchange exchange) throws
Exception {
                            InputStream inputStream =
                            while ( != -1) {}
        HttpClient client = new HttpClient();
        PostMethod method = new PostMethod("http://localhost:8989/bigfile");
        File file = new File("c:\\temp\\test.bin.ok2");
        method.setRequestEntity(new FileRequestEntity(file,
        assertEquals(200, client.executeMethod(method));

This fails with an OutOfMemoryError if test.bin.ok2 is a larger file because
the StreamCachingInterceptor reads the input stream into memory. Now I
understand that stream caching is turned on by default in Camel 1.6.
However, as you can see I tried to disable it in the route builder. This
seems not to make any difference.

Now, my question is if there is some other way to disable stream caching or
if I'm doing something wrong here.

Thanks in advance
View this message in context:
Sent from the Camel - Users (activemq) mailing list archive at

View raw message