It's not clear why would one use a @Retryable
in Spring Integration when there is that RequestHandlerRetryAdvice
: https://docs.spring.io/spring-integration/docs/current/reference/html/messaging-endpoints.html#message-handler-advice-chain...
Anyway see this option on the @Retryable
:
/**
* Retry interceptor bean name to be applied for retryable method. Is mutually
* exclusive with other attributes.
* @return the retry interceptor bean name
*/
String interceptor() default "";
So, instead of @Recover
method you provide your own:
@Bean
public MethodInterceptor retryInterceptor() {
return RetryInterceptorBuilder.stateless()
.maxAttempts(...)
.recoverer(...)
.build();
}
...
@Retryable(interceptor = "retryInterceptor")
public void service() {