Brad, thank you for the suggestion. However, the documentation of
netty4-http states: "Notice Netty4 HTTP reads the entire stream into
memory using io.netty.handler.codec.http.HttpObjectAggregator to build
the entire full http message.", which is exactly what I don't want as
the application is supposed to handle uploads of multiple Gbs
simultaneously.

Kind regards,

Jonas



On Sun, Aug 21, 2016 at 2:01 AM, Brad Johnson
<brad.john...@mediadriver.com> wrote:
> Perhaps the netty component would be better for this but I don't have a lot
> of experience with it.  It's just my understanding is that it really shines
> for this type of streaming operation.
>
> http://camel.apache.org/netty4-http.html
>
> Brad
>
> On Sat, Aug 20, 2016 at 6:44 AM, Jonas Koperdraat <jo...@jonaskoperdraat.nl>
> wrote:
>
>> Hi,
>>
>> I am trying to process a multipart/form-data upload in a streaming
>> manner. We are using camel-servlet and camel-rest (2.17.0) to route
>> REST paths to Spring beans for processing the request. However, with
>> anything that I have tried, I only get to the Spring bean after the
>> entire request has been recieved, including the entire multipart
>> message.
>>
>> I would like to be able to process the uploaded file without it being
>> temporarily stored in memory or on disk as our application will need
>> to be able to process very large uploads simultaneously. I can
>> accomplish this when implementing a HttpRequestServlet and using
>> Apache's commons-fileupload
>> (https://commons.apache.org/proper/commons-fileupload/streaming.html),
>> but I'm having less luck when using Camel to route REST paths to our
>> beans.
>>
>> We define our rest paths like so:
>>
>> rest("upload")
>>    .post()
>>    .route()
>>    .bean(UploadHandler.class, "handleUpload");
>>
>> Explicitly adding noStreamCaching() to the route doesn't seem to
>> change anything (which makes sense, given that the default behaviour
>> as of Camel 2.0 is not to cache streams).
>>
>> Some of the options i've tried:
>>  * Not using camel-rest, but directly route from camel-servlet
>>  * Not using .bean, but .to
>>  * Using .process
>>  * Using camel-jetty
>>
>> But each attempt had the same effect; the entire request had to be
>> received (and presumably processed by Camel into an Exchange object)
>> before I could start processing it in my bean.
>>
>> Is it possible to use Camel to route an HTTP POST request to a Spring
>> bean in such a way that I can the process it in a streaming manner?
>> And if so, how?
>>
>> Any help is greatly appreciated.
>>
>> Kind regards,
>>
>> Jonas Koperdraat
>>

Reply via email to