Does anyone know the recommended pattern for managing HttpClient lifecycle within the NICE CXone Java Platform SDK when running in a high-throughput environment? I am refactoring a legacy integration that uses the SDK to push real-time conversation transcripts to our internal data lake via a custom webhook proxy. The application runs on a Kubernetes cluster with multiple pods, each handling roughly 500 concurrent WebSocket streams. We are seeing intermittent java.net.SocketTimeoutException: Connect timed out errors specifically when polling /api/v2/webmessaging/messages for delta updates. The current implementation initializes a new PlatformClient instance per request thread, which seems to be bypassing any underlying connection pooling mechanisms. I have attempted to configure the underlying Apache HttpClient via the Configuration builder, but the SDK appears to wrap or override these settings. Here is the current initialization block:
Configuration config = Configuration.builder()
.clientId("client-id")
.clientSecret("secret")
.environment(Environment.Production)
.build();
// Attempting to inject custom connection pool
PoolingHttpClientConnectionManager pool = new PoolingHttpClientConnectionManager();
pool.setMaxTotal(200);
pool.setDefaultMaxPerRoute(50);
// How do I attach this to the PlatformClient?
PlatformClient client = PlatformClientFactory.createClient(config);
The SDK does not expose a direct method to set the connection manager. I suspect the default client is using a single-threaded or low-limit pool that exhausts quickly under load. Is there a documented way to inject a custom HttpClient or PoolingHttpClientConnectionManager into the PlatformClient instance? Alternatively, should I be using the raw REST endpoints directly for this specific high-frequency polling use case to avoid SDK overhead? Any insights on thread-safe client sharing patterns for the Java SDK would be appreciated. We are currently on SDK version 11.x.