Hi,

first of all, thanks to both of you, Gert and Willem, for the quick replies.
I saw that the jira was already fixed, great job.

Does this mean that the methods for disabling stream caching will be removed
in the future?

I have tried to use "noErrorHandler" but there was a special case that used
the default error handler at some point and I wasn't able to change this. A
drilled down version of my scenario is shown in the test case below.

It has to do with the choice and when elements in the route. They seem to
introduce the standard error handler, as they don't inherit the configured
one. The standard error handling then configures the route to use stream
caching again. For some reason this only seems to happen if the JMX agent is
disabled in the CamelContext, which I simulate by setting the system
property. Of course, in our real scenario we simply disable it in the
application context.

    @Test
    public void testUploadFailsForBigFileWithNoErrorHandler() throws
Exception {
        System.setProperty(JmxSystemPropertyKeys.DISABLED, "true");
        DefaultCamelContext context = new DefaultCamelContext();
        
        context.addRoutes(new RouteBuilder() {
            @Override
            public void configure() throws Exception {
                errorHandler(noErrorHandler());
                
                from("jetty:http://localhost:8989/bigfile";)
                   
.choice().when(header("foo").isEqualTo("bar")).to("direct:end")
                    .otherwise().end();
                
                from("direct:end")
                    .process(new Processor() {
                        public void process(Exchange exchange) throws
Exception {
                            InputStream inputStream =
exchange.getIn().getBody(InputStream.class);
                            while (inputStream.read() != -1) {}
                        }
                    });
            }            
        });
        
        context.start();
        
        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,
"unknown/unknown"));
        assertEquals(200, client.executeMethod(method));
    }    

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

Reply via email to