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