spring-retry
spring-retry copied to clipboard
Make Retry and Circuit Breaker composable
I want to achieve following behaviour: Specific execution failures are first retried according to e.g. a SimpleRetryPolicy
, then if the policy is exceeded the failure is recorded by the CircuitBreaker.
Although both SimpleRetryPolicy
and CircuitBreakerPolicy
implement RetryPolicy
and can be used to forge a CompositeRetryPolicy
, this seems not to be an intended use-case for Spring Retry.
It feels like the reason for this is that stateful (CircuitBreaker) and stateless retries are not (yet?) composable due to some shared global state. Or am I missing something?
Seems like a reasonable goal theoretically. But why would you not just change the parameters of the circuit breaker? What is the benefit of a composite that you don't get from a delegation model (as is already implemented in CircuitBreakerRetryPolicy
)?