diff options
Diffstat (limited to 'cps-ncmp-service')
-rw-r--r-- | cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/config/NcmpConfiguration.java | 7 |
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; } |