Package io.mosip.kernel.core.retry
Class RetryConfig
- java.lang.Object
-
- io.mosip.kernel.core.retry.RetryConfig
-
@Configuration @EnableAspectJAutoProxy public class RetryConfig extends Object
The Class RetryConfig - to configure retry template with retry/back off policies as per configuration.- Author:
- Loganathan Sekar
-
-
Constructor Summary
Constructors Constructor Description RetryConfig()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description org.springframework.retry.backoff.BackOffPolicybackOffPolicy(long initialIntervalMilliSecs, double multiplier, long maxIntervalMilliSecs)Back off policy.protected Map<Class<? extends Throwable>,Boolean>getRetryableExceptionsFromConfig()Gets the retryable exceptions from config.org.springframework.retry.RetryPolicyretryPolicy(int retryLimit, boolean traverseRootCause)Retry policy.org.springframework.retry.support.RetryTemplateretryTemplate(org.springframework.retry.RetryPolicy retryPolicy, org.springframework.retry.backoff.BackOffPolicy backOffPolicy, org.springframework.retry.RetryListener retryListener)Retry template.
-
-
-
Method Detail
-
retryPolicy
@Bean public org.springframework.retry.RetryPolicy retryPolicy(@Value("${kernel.retry.attempts.limit:5}") int retryLimit, @Value("${kernel.retry.traverse.root.cause.enabled:true}") boolean traverseRootCause)Retry policy.- Parameters:
retryLimit- the retry limit- Returns:
- the retry policy
-
getRetryableExceptionsFromConfig
protected Map<Class<? extends Throwable>,Boolean> getRetryableExceptionsFromConfig()
Gets the retryable exceptions from config.- Returns:
- the retryable exceptions from config
-
backOffPolicy
@Bean public org.springframework.retry.backoff.BackOffPolicy backOffPolicy(@Value("${kernel.retry.exponential.backoff.initial.interval.millisecs:200}") long initialIntervalMilliSecs, @Value("${kernel.retry.exponential.backoff.multiplier:1.0}") double multiplier, @Value("${kernel.retry.exponential.backoff.max.interval.millisecs:5000}") long maxIntervalMilliSecs)Back off policy.- Parameters:
initialIntervalMilliSecs- the initial interval milli secsmultiplier- the multipliermaxIntervalMilliSecs- the max interval milli secs- Returns:
- the back off policy
-
retryTemplate
@Bean public org.springframework.retry.support.RetryTemplate retryTemplate(org.springframework.retry.RetryPolicy retryPolicy, org.springframework.retry.backoff.BackOffPolicy backOffPolicy, org.springframework.retry.RetryListener retryListener)Retry template.- Parameters:
retryPolicy- the retry policybackOffPolicy- the back off policyretryListener- the retry listener- Returns:
- the retry template
-
-