postmark-java icon indicating copy to clipboard operation
postmark-java copied to clipboard

Java 8 Connection Reset (Cont'd)

Open amwakefield-olson opened this issue 1 year ago • 0 comments

Hello!

We are still experiencing Connection Reset issues with the Pooling Manager as it stands today. I was wondering if y'all would be able to make an update to allow us to be able to set custom max total and default routes per connection within the HttpClient constructor.

Here is an example.

public HttpClient(Map<String, Object> headers, int connectTimeoutSeconds, int readTimeoutSeconds, int totalMaxConnections, int defaultConnectionMaxPerRoute) {
        this.headers = headers;
        this.clientConfigBuilder = RequestConfig
                .custom()
                .setConnectTimeout(Timeout.ofSeconds(connectTimeoutSeconds))
                .setConnectionRequestTimeout(Timeout.ofSeconds(connectTimeoutSeconds))
                .setConnectionKeepAlive(Timeout.ofSeconds(connectTimeoutSeconds))
                .setResponseTimeout(Timeout.ofSeconds(readTimeoutSeconds));

        this.connectionManager = new PoolingHttpClientConnectionManager();
        connectionManager.setMaxTotal(totalMaxConnections);
        connectionManager.setDefaultMaxPerRoute(defaultConnectionMaxPerRoute);

        this.client = HttpClients.custom().setConnectionManager(connectionManager).build();
  }

Thanks!

Allan

amwakefield-olson avatar Dec 12 '24 18:12 amwakefield-olson