HTTP (Stream) to File only writes part of InputStream to File -------------------------------------------------------------
Key: CAMEL-2475 URL: https://issues.apache.org/activemq/browse/CAMEL-2475 Project: Apache Camel Issue Type: Bug Components: camel-http Affects Versions: 2.1.0 Reporter: Leen Toelen Priority: Minor The follwoing route only writes part of the http input stream to the file output (always in chunks of 1,2,4 or 8KB).: <route id="RestToTempDir"> <from uri="jetty:http://0.0.0.0:8162/muyrl" /> <setHeader headerName="CamelFileExchangeFile"> <header>message.id</header> </setHeader> <to uri="file://c:/temp/?fileName=${date:now:yyyyMMdd}/asm-${id}.xml" /> <setBody> <header>CamelFileExchangeFile</header> </setBody> </route> There are workarounds, but I would change streams to always read until EOF (if possible) Possible workaround 1: <convertBodyTo type="java.lang.String"/> to force it to convert the stream to string before writing. Possible workaround 2 is to write to a queue first <route id="RestToTempDir"> <from uri="jetty:http://0.0.0.0:8162/myurl" /> <inOnly uri="activemq:topic=TempTopic" /> <setBody> <header>message.id</header> </setBody> <setHeader headerName="CamelFileExchangeFile"> <header>message.id</header> </setHeader> </route> <route id="TempAssemblyToTempArchiveDirectory"> <from uri="activemq:topic:TempTopic" /> <setHeader headerName="CamelFileExchangeFile"> <header>message.id</header> </setHeader> <to uri="file://c:/xmlarchive_noxslt/?fileName=${date:now:yyyyMMdd}/asm-${id}.xml"/> </route> -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.