We’re running a Java service that batches contact updates via the Genesys Cloud Java SDK. It works fine for small batches, but when we hit ~500 concurrent requests, the threads start blocking and eventually we get timeouts.
Here’s the setup:
PureCloudPlatform client = PureCloudPlatform.auth().oauth2().clientCredentials(clientId, clientSecret, baseUrl);
RoutingApi routingApi = new RoutingApi(client);
// Inside a parallel stream
contacts.forEach(contact -> {
try {
routingApi.postRoutingContactWrappersUpdate(contactId, updateBody);
} catch (ApiException e) {
log.error("Failed to update", e);
}
});
The error I’m seeing in the logs is:
io.swagger.client.ApiException: Connection pool timed out waiting for connection
at org.apache.http.impl.conn.PoolingHttpClientConnectionManager.leaseConnection(PoolingHttpClientConnectionManager.java:312)
...```
I know the default `HttpClientBuilder` in the SDK uses a basic pool. I tried setting the pool size manually on the `ApiClient` instance, but the SDK doesn't expose the underlying `PoolingHttpClientConnectionManager` easily for configuration.
How do you guys handle high-throughput scenarios with the Java SDK? Should I be creating a custom `ApiClient` with a tuned `CloseableHttpClient`, or is there a recommended pattern for reusing connections across these batch jobs?