kumuluz / kumuluzee

Lightweight open-source framework for developing microservices using standard Java EE technologies and migrating Java EE to cloud-native architecture.
https://ee.kumuluz.com
MIT License
291 stars 71 forks source link

mp-rest-client jetty client buffer #185

Closed eriskooo closed 3 years ago

eriskooo commented 3 years ago

Hello,

plz, Is there any chance to modify size of jetty's read buffer ?

now we have on one environment problem such as

javax.ws.rs.ProcessingException: java.util.concurrent.ExecutionException: java.lang.IllegalArgumentException: Buffering capacity 2097152 exceeded at org.glassfish.jersey.jetty.connector.JettyConnector.apply(JettyConnector.java:249)

can this be modified (not seen in EEConfig page) ?

many thanx,

e.

cen1 commented 3 years ago

Hi

not possible right now. Jersey added support last year, see https://github.com/eclipse-ee4j/jersey/pull/4089/commits/6a83e77aa444279f0e1eee2cd850588361468589 (example is in a test on the bottom of the commit)

We need to bump jersey dependency to allow this in kumuluz. In theory you could override jersey dependency versions in your own maven pom, I believe it is a minor release bump so it might be just fine.

In the meantime as a workaround you can replace Jetty connector with java.net which I believe has bigger buffer by default:

ClientConfig clientConfig = new ClientConfig();
clientConfig.connectorProvider(new HttpUrlConnectorProvider());

Unless you rely on some specific jetty client functionality it should be a seamless replacement.

eriskooo commented 3 years ago

ok, thank you !

eriskooo commented 3 years ago

Hi, still struggling, my code is something like

private PaymentServiceClient newClient(final URI uri) {
    return RestClientBuilder.newBuilder()
                            .baseUri(uri)
                            .build(PaymentServiceClient.class);
}

how should I modify read buffer plz ?

cen1 commented 3 years ago

Sorry, I thought you are using jax-rs client.

MP-rest-client currently has no option to configure connectors, we will have to expand kumuluzee-rest-client extension to support it.