I've got a back-end web service returning large **chunked** data. I have defined a Camel route with a proxy to this web service. I do not want Camel to buffer the entire back-end response, and then return it as a whole to the client. Instead, i would like to preserve the original streaming (mainly to avoid read timeouts on the client side).
How can i achieve this (a "pipe" actually) in Camel ? Even when I disable "streamCache" on CamelContext, it seems Camel is yet buffering internally the response. Hereunder the difference between a direct call to the back-end, and the same call via Camel: <http://camel.465427.n5.nabble.com/file/n5735075/difference.png> => see Latency ! In the first case, client gets a beginning of response after 2 sec, while in the second case, he has to wait for 12 sec before getting any data... I looked into the code of "HttpProducer.java", and I'm a bit puzzled about what i can see in the "doExtractResponseBodyAsStream" method: private static InputStream doExtractResponseBodyAsStream(InputStream is, Exchange exchange) throws IOException { // As httpclient is using a AutoCloseInputStream, it will be closed when the connection is closed // we need to cache the stream for it. try { // This CachedOutputStream will not be closed when the exchange is onCompletion CachedOutputStream cos = new CachedOutputStream(exchange, false); IOHelper.copy(is, cos); // When the InputStream is closed, the CachedOutputStream will be closed return cos.getWrappedInputStream(); } finally { IOHelper.close(is, "Extracting response body", LOG); } } If you always *copy* the stream, you need to read the whole stream :-( Where do you take account of the "streamCache" flag when deciding to cache or not cache the response input stream ? Thanks for your help. Bernard. -- View this message in context: http://camel.465427.n5.nabble.com/Chunking-issue-with-http-producer-tp5735075.html Sent from the Camel - Users mailing list archive at Nabble.com.