[ 
https://issues.apache.org/jira/browse/CAMEL-19905?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17782471#comment-17782471
 ] 

James Netherton commented on CAMEL-19905:
-----------------------------------------

Not sure if this is the right way of going about fixing this, but I made a POC 
that could handle large requests / response payloads.

https://github.com/apache/camel/compare/main...jamesnetherton:camel:CAMEL-19905

I added a new 'useStreaming' option. When true the request body is handled in a 
different way to normal. E.g don't register the normal BodyHandler, but instead 
register a handler on the incoming Vert.x HttpRequest that lets us read the 
body payload in chunks. Then we feed each chunk into `CachedOutputStream` which 
we can use to get an `InputStream` for the exchange message body. That allows 
overflow to disk if needed.

I have a basic unit test that uploads and echos back a 4GB payload and it seems 
to be working ok. Also tested with a small heap size and that was ok.

> camel-platform-http-vertx - Streaming mode for message body
> -----------------------------------------------------------
>
>                 Key: CAMEL-19905
>                 URL: https://issues.apache.org/jira/browse/CAMEL-19905
>             Project: Camel
>          Issue Type: Improvement
>          Components: camel-platform-http-vertx
>            Reporter: Claus Ibsen
>            Priority: Major
>
> It appears that when you have big HTTP requests then vertx-http server will 
> read all content into memory.
> At first glance it does not seems an easy API to use some kind of streaming 
> mode via java.io.InputStream as the message body type.
> The vertx based Buffer appears to be read entirely into memory.
> io.vertx.ext.web.handler.BodyHandler#create()
> See the following code
> https://github.com/apache/camel/blob/b7eed290f06dc483e67892b3bb1cfccc0a4e1f1e/components/camel-platform-http-vertx/src/main/java/org/apache/camel/component/platform/http/vertx/VertxPlatformHttpConsumer.java#L276



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to