Java源码示例:org.springframework.retry.interceptor.RetryInterceptorBuilder
示例1
@Bean
@ConditionalOnMissingBean(name = "configServerRetryInterceptor")
public RetryOperationsInterceptor configServerRetryInterceptor() {
log.info(String.format(
"configServerRetryInterceptor: Changing backOffOptions " +
"to initial: %s, multiplier: %s, maxInterval: %s",
1000, 1.2, 5000));
return RetryInterceptorBuilder
.stateless()
.backOffOptions(1000, 1.2, 5000)
.maxAttempts(10)
.build();
}
示例2
@Bean(name = "serviceCombConfigRetryInterceptor")
@ConditionalOnMissingBean(name = "serviceCombConfigRetryInterceptor")
public RetryOperationsInterceptor serviceCombConfigRetryInterceptor(
ServiceCombConfigProperties serviceCombConfigProperties) {
return RetryInterceptorBuilder.stateless()
.backOffOptions(serviceCombConfigProperties.getRetry().getInitialInterval(),
serviceCombConfigProperties.getRetry().getMultiplier(),
serviceCombConfigProperties.getRetry().getMaxInterval())
.maxAttempts(serviceCombConfigProperties.getRetry().getMaxAttempts()).build();
}
示例3
@Bean
@ConditionalOnMissingBean
@ConditionalOnDefaultFlowEnabled(name = "configServerRetryInterceptor")
public RetryOperationsInterceptor configServerRetryInterceptor() {
log.info("Creating custom retry interceptor");
return RetryInterceptorBuilder.stateless().backOffOptions(3000, 1.5, 10000).maxAttempts(10).build();
}
示例4
@Bean
@ConditionalOnMissingBean(name = "configServerRetryInterceptor")
public RetryOperationsInterceptor configServerRetryInterceptor(
RetryProperties properties) {
return RetryInterceptorBuilder.stateless()
.backOffOptions(properties.getInitialInterval(),
properties.getMultiplier(), properties.getMaxInterval())
.maxAttempts(properties.getMaxAttempts()).build();
}
示例5
@Bean(name = "consulRetryInterceptor")
@ConditionalOnMissingBean(name = "consulRetryInterceptor")
public RetryOperationsInterceptor consulRetryInterceptor(
RetryProperties properties) {
return RetryInterceptorBuilder.stateless()
.backOffOptions(properties.getInitialInterval(),
properties.getMultiplier(), properties.getMaxInterval())
.maxAttempts(properties.getMaxAttempts()).build();
}
示例6
@Bean
@ConditionalOnMissingBean(name = "configServerRetryInterceptor")
public RetryOperationsInterceptor configServerRetryInterceptor() {
return RetryInterceptorBuilder.stateless().backOffOptions(1000, 1.2, 5000).maxAttempts(10).build();
}