summaryrefslogtreecommitdiffstats
path: root/cps-ncmp-service/src/main
diff options
context:
space:
mode:
authormpriyank <priyank.maheshwari@est.tech>2022-08-18 10:35:12 +0100
committermpriyank <priyank.maheshwari@est.tech>2022-08-18 10:35:59 +0100
commit6cd3d9c541abfcecc5fe75520a08fef72f6b476e (patch)
tree40e6a7145721a3339d4abc685a71d26cc8125253 /cps-ncmp-service/src/main
parent060499cb5a89a0fd3d8480132ed82d2e291839dc (diff)
Performance Improvement: Tune Resttemplate
- Increase connection and read timeout for Resttemplate to a higer value Issue-ID: CPS-1201 Change-Id: Ia159b022698ff60dbd02a5877899f520b91bf883 Signed-off-by: mpriyank <priyank.maheshwari@est.tech>
Diffstat (limited to 'cps-ncmp-service/src/main')
-rw-r--r--cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/config/NcmpConfiguration.java7
1 files changed, 6 insertions, 1 deletions
diff --git a/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/config/NcmpConfiguration.java b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/config/NcmpConfiguration.java
index a41815554f..f250ddb73a 100644
--- a/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/config/NcmpConfiguration.java
+++ b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/config/NcmpConfiguration.java
@@ -20,6 +20,7 @@
package org.onap.cps.ncmp.api.impl.config;
+import java.time.Duration;
import java.util.Arrays;
import lombok.AccessLevel;
import lombok.Getter;
@@ -39,6 +40,9 @@ import org.springframework.web.client.RestTemplate;
@RequiredArgsConstructor(access = AccessLevel.PROTECTED)
public class NcmpConfiguration {
+ private static final Duration CONNECTION_TIMEOUT_MILLISECONDS = Duration.ofMillis(180000);
+ private static final Duration READ_TIMEOUT_MILLISECONDS = Duration.ofMillis(180000);
+
@Getter
@Component
public static class DmiProperties {
@@ -59,7 +63,8 @@ public class NcmpConfiguration {
@Bean
@Scope(ConfigurableBeanFactory.SCOPE_SINGLETON)
public static RestTemplate restTemplate(final RestTemplateBuilder restTemplateBuilder) {
- final RestTemplate restTemplate = restTemplateBuilder.build();
+ final RestTemplate restTemplate = restTemplateBuilder.setConnectTimeout(CONNECTION_TIMEOUT_MILLISECONDS)
+ .setReadTimeout(READ_TIMEOUT_MILLISECONDS).build();
setRestTemplateMessageConverters(restTemplate);
return restTemplate;
}