Reputation: 2861
I'm using the following route:
<route>
<from uri="file:...
<setHeader headerName="CamelHttpMethod">
<constant>PUT</constant>
</setHeader>
<to uri="jetty:http://localhost:55556/extract?restletMethod=PUT"/>
<to uri="ejb:java:global/Abc/Bean?method=doSomething(${body}, ${headers})"/>
</route>
Endpoint:
public InputStream extract(@Body InputStream inputStream, @Headers Map<String, Object> headers) throws Exception {
byte[] b = IOUtils.toByteArray(inputStream);
// do some stuff
headers.put("extraction", ...);
return new ByteArrayInputStream(b);
}
If the file size exceeds 2 MB the following exception occurs: (Camel-Jetty http proxy + large response data casue issue: Buffering capacity exceeded)
JettyClient failed cause by: Buffering capacity exceeded. Exchange[ID-debianjk-scsynergy-local-43219-1479191420664-41-8]. Caused by: [java.lang.IllegalArgumentException - Buffering capacity exceeded]
at org.apache.camel.component.jetty9.JettyContentExchange9.doTaskCompleted(JettyContentExchange9.java:156)
at org.apache.camel.component.jetty9.JettyContentExchange9$2.onComplete(JettyContentExchange9.java:222)
at org.eclipse.jetty.client.ResponseNotifier.notifyComplete(ResponseNotifier.java:193)
at org.eclipse.jetty.client.ResponseNotifier.notifyComplete(ResponseNotifier.java:185)
at org.eclipse.jetty.client.HttpReceiver.terminateResponse(HttpReceiver.java:453)
at org.eclipse.jetty.client.HttpReceiver.terminateResponse(HttpReceiver.java:434)
at org.eclipse.jetty.client.HttpReceiver.responseContent(HttpReceiver.java:360)
at org.eclipse.jetty.client.http.HttpReceiverOverHTTP.content(HttpReceiverOverHTTP.java:254)
at org.eclipse.jetty.client.http.HttpReceiverOverHTTP.content(HttpReceiverOverHTTP.java:38)
at org.eclipse.jetty.http.HttpParser.parseContent(HttpParser.java:1472)
at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:1245)
at org.eclipse.jetty.client.http.HttpReceiverOverHTTP.parse(HttpReceiverOverHTTP.java:156)
at org.eclipse.jetty.client.http.HttpReceiverOverHTTP.process(HttpReceiverOverHTTP.java:117)
at org.eclipse.jetty.client.http.HttpReceiverOverHTTP.receive(HttpReceiverOverHTTP.java:69)
at org.eclipse.jetty.client.http.HttpChannelOverHTTP.receive(HttpChannelOverHTTP.java:89)
at org.eclipse.jetty.client.http.HttpConnectionOverHTTP.onFillable(HttpConnectionOverHTTP.java:123)
at org.eclipse.jetty.io.AbstractConnection$2.run(AbstractConnection.java:544)
at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:635)
at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:555)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.IllegalArgumentException: Buffering capacity exceeded
at org.eclipse.jetty.client.util.BufferingResponseListener.onContent(BufferingResponseListener.java:114)
at org.eclipse.jetty.client.api.Response$Listener$Adapter.onContent(Response.java:245)
at org.eclipse.jetty.client.ResponseNotifier.notifyContent(ResponseNotifier.java:124)
at org.eclipse.jetty.client.ResponseNotifier.access$100(ResponseNotifier.java:35)
at org.eclipse.jetty.client.ResponseNotifier$ContentCallback.process(ResponseNotifier.java:274)
at org.eclipse.jetty.util.IteratingCallback.processing(IteratingCallback.java:246)
at org.eclipse.jetty.util.IteratingCallback.iterate(IteratingCallback.java:208)
at org.eclipse.jetty.client.ResponseNotifier.notifyContent(ResponseNotifier.java:117)
at org.eclipse.jetty.client.HttpReceiver.responseContent(HttpReceiver.java:322)
... 13 more
Questions:
Is there a way to avoid this buffering issue? (Maybe by using another component instead of jetty?)
Since the body is not changed in the jetty-endpoint I was wondering if it's possible to "bypass" the body directly to the next endpoint.
Upvotes: 1
Views: 1091
Reputation: 2861
Using <to uri="http://localhost:55556/extract?restletMethod=PUT"/>
fixed it for me.
Upvotes: 1