diff --git a/partner/partner-management-service/pom.xml b/partner/partner-management-service/pom.xml
index 7095697fbf..f2d691947c 100644
--- a/partner/partner-management-service/pom.xml
+++ b/partner/partner-management-service/pom.xml
@@ -5,10 +5,10 @@
pms-parent
io.mosip.pms
- 1.1.5.4
+ 1.1.5.4-p1-SNAPSHOT
- 1.1.5.4
+ 1.1.5.4-p1-SNAPSHOT
partner-management-service
partner-management-service
@@ -31,7 +31,7 @@
io.mosip.pms
pms-common
- 1.1.5.4
+ 1.1.5.4-p1-SNAPSHOT
org.springframework.boot
@@ -112,4 +112,4 @@
-
\ No newline at end of file
+
diff --git a/partner/pms-common/pom.xml b/partner/pms-common/pom.xml
index 4e6725da57..5f0ef67ae2 100644
--- a/partner/pms-common/pom.xml
+++ b/partner/pms-common/pom.xml
@@ -6,10 +6,10 @@
io.mosip.pms
pms-parent
- 1.1.5.4
+ 1.1.5.4-p1-SNAPSHOT
pms-common
- 1.1.5.4
+ 1.1.5.4-p1-SNAPSHOT
pms-common
UTF-8
@@ -40,4 +40,4 @@
${kernel-websubclient-api.version}
-
\ No newline at end of file
+
diff --git a/partner/pms-common/src/main/java/io/mosip/pms/common/util/RestUtil.java b/partner/pms-common/src/main/java/io/mosip/pms/common/util/RestUtil.java
index ab4657ae03..b7a91987a8 100644
--- a/partner/pms-common/src/main/java/io/mosip/pms/common/util/RestUtil.java
+++ b/partner/pms-common/src/main/java/io/mosip/pms/common/util/RestUtil.java
@@ -23,6 +23,7 @@
import org.apache.http.impl.client.HttpClients;
import org.apache.http.ssl.TrustStrategy;
import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
import org.springframework.core.env.Environment;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
@@ -54,6 +55,14 @@ public class RestUtil {
private Environment environment;
private static final String AUTHORIZATION = "Authorization=";
+
+ private RestTemplate localRestTemplate;
+
+ @Value("${pms.default.httpclient.connections.max.per.host:20}")
+ private int maxConnectionPerRoute;
+
+ @Value("${pms.default.httpclient.connections.max:100}")
+ private int totalMaxConnection;
@SuppressWarnings("unchecked")
public T postApi(String apiUrl, List pathsegments, String queryParamName, String queryParamValue,
@@ -169,16 +178,15 @@ public T getApi(String apiUrl, Map pathsegments, Class> re
}
public RestTemplate getRestTemplate() throws KeyManagementException, NoSuchAlgorithmException, KeyStoreException {
- TrustStrategy acceptingTrustStrategy = (X509Certificate[] chain, String authType) -> true;
- SSLContext sslContext = org.apache.http.ssl.SSLContexts.custom().loadTrustMaterial(null, acceptingTrustStrategy)
- .build();
- SSLConnectionSocketFactory csf = new SSLConnectionSocketFactory(sslContext);
- CloseableHttpClient httpClient = HttpClients.custom().setSSLSocketFactory(csf).build();
- HttpComponentsClientHttpRequestFactory requestFactory = new HttpComponentsClientHttpRequestFactory();
- requestFactory.setHttpClient(httpClient);
-
- return new RestTemplate(requestFactory);
-
+ if(localRestTemplate==null) {
+ HttpClientBuilder httpClientBuilder = HttpClients.custom()
+ .setMaxConnPerRoute(maxConnectionPerRoute)
+ .setMaxConnTotal(totalMaxConnection).disableCookieManagement();
+ HttpComponentsClientHttpRequestFactory requestFactory = new HttpComponentsClientHttpRequestFactory();
+ requestFactory.setHttpClient(httpClientBuilder.build());
+ localRestTemplate= new RestTemplate(requestFactory);
+ }
+ return localRestTemplate;
}
@SuppressWarnings("unchecked")
diff --git a/partner/policy-management-service/pom.xml b/partner/policy-management-service/pom.xml
index 7eb7197125..54c787eaea 100644
--- a/partner/policy-management-service/pom.xml
+++ b/partner/policy-management-service/pom.xml
@@ -5,9 +5,9 @@
pms-parent
io.mosip.pms
- 1.1.5.4
+ 1.1.5.4-p1-SNAPSHOT
- 1.1.5.4
+ 1.1.5.4-p1-SNAPSHOT
policy-management-service
policy-management-service
@@ -19,7 +19,7 @@
io.mosip.pms
pms-common
- 1.1.5.4
+ 1.1.5.4-p1-SNAPSHOT
io.micrometer
@@ -118,4 +118,4 @@
-
\ No newline at end of file
+
diff --git a/partner/pom.xml b/partner/pom.xml
index 55d4e95276..1c13397866 100644
--- a/partner/pom.xml
+++ b/partner/pom.xml
@@ -5,7 +5,7 @@
io.mosip.pms
pms-parent
pom
- 1.1.5.4
+ 1.1.5.4-p1-SNAPSHOT
partner-management-services
Parent project of MOSIP partner-management-services
@@ -72,7 +72,7 @@
- policy-validator
+
pms-common
policy-management-service
partner-management-service
@@ -273,4 +273,4 @@
-
\ No newline at end of file
+