Looking for advice on why the Genesys Cloud Java SDK is not respecting our custom HTTP client configuration for connection pooling. We are building a high-throughput token service and need to manage thread-safe HTTP connections efficiently. According to the documentation, we can pass a pre-configured ApacheHttpClient to the ApiClient constructor.
Here is our initialization code:
PoolingHttpClientConnectionManager connectionManager = new PoolingHttpClientConnectionManager();
connectionManager.setMaxTotal(200);
connectionManager.setDefaultMaxPerRoute(50);
CloseableHttpClient httpClient = HttpClients.custom()
.setConnectionManager(connectionManager)
.build();
ApiClient client = ApiClient.newBuilder().setHttpClient(httpClient).build();
However, under load, we see ConnectionPoolTimeoutException errors when calling /api/v2/oauth/token. The SDK seems to be ignoring the pool settings or creating new clients per request internally.
We are sending this payload:
{
"grant_type": "client_credentials",
"client_id": "xxx",
"client_secret": "yyy"
}
Why does the SDK not adhere to the provided HttpClient instance? Is there a specific method to ensure thread-safety across multiple worker threads using the same ApiClient instance?