aboutsummaryrefslogtreecommitdiffstats
path: root/rest-services/dmaap-client/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/dmaap/client/api/DmaapClientFactory.java
diff options
context:
space:
mode:
Diffstat (limited to 'rest-services/dmaap-client/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/dmaap/client/api/DmaapClientFactory.java')
-rw-r--r--rest-services/dmaap-client/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/dmaap/client/api/DmaapClientFactory.java13
1 files changed, 13 insertions, 0 deletions
diff --git a/rest-services/dmaap-client/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/dmaap/client/api/DmaapClientFactory.java b/rest-services/dmaap-client/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/dmaap/client/api/DmaapClientFactory.java
index 95850078..ee4f6d38 100644
--- a/rest-services/dmaap-client/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/dmaap/client/api/DmaapClientFactory.java
+++ b/rest-services/dmaap-client/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/dmaap/client/api/DmaapClientFactory.java
@@ -23,6 +23,8 @@ import io.vavr.control.Option;
import org.jetbrains.annotations.NotNull;
import org.onap.dcaegen2.services.sdk.rest.services.adapters.http.RxHttpClient;
import org.onap.dcaegen2.services.sdk.rest.services.adapters.http.RxHttpClientFactory;
+import org.onap.dcaegen2.services.sdk.rest.services.adapters.http.config.ConnectionPoolConfig;
+import org.onap.dcaegen2.services.sdk.rest.services.adapters.http.config.ImmutableConnectionPoolConfig;
import org.onap.dcaegen2.services.sdk.rest.services.adapters.http.config.ImmutableRetryConfig;
import org.onap.dcaegen2.services.sdk.rest.services.adapters.http.config.ImmutableRxHttpClientConfig;
import org.onap.dcaegen2.services.sdk.rest.services.adapters.http.config.RetryConfig;
@@ -68,6 +70,7 @@ public final class DmaapClientFactory {
private static @NotNull RxHttpClient createHttpClient(DmaapClientConfiguration config) {
RxHttpClientConfig clientConfig = ImmutableRxHttpClientConfig.builder()
+ .connectionPool(createConnectionPool(config))
.retryConfig(createRetry(config))
.build();
return config.securityKeys() == null
@@ -85,5 +88,15 @@ public final class DmaapClientFactory {
.build())
.getOrNull();
}
+
+ private static ConnectionPoolConfig createConnectionPool(DmaapClientConfiguration config){
+ return Option.of(config.connectionPoolConfig())
+ .map(cp -> ImmutableConnectionPoolConfig.builder()
+ .connectionPool(cp.connectionPool())
+ .maxIdleTime(Duration.ofSeconds(cp.maxIdleTime()))
+ .maxLifeTime(Duration.ofSeconds(cp.maxLifeTime()))
+ .build())
+ .getOrNull();
+ }
}