Skip to content

[Spring Retry] Add possibility to customize openTimeout&resetTimeout. #238

@OldIMP

Description

@OldIMP

Is your feature request related to a problem? Please describe.
Right now as of v3.2.1, there's no possibility to customize openTimeout&resetTimeout intuitively as in https://docs.spring.io/spring-cloud-circuitbreaker/reference/spring-cloud-circuitbreaker-spring-retry.html.

I've tried to configure my own CircuitBreakerRetryPolicy as below...

CircuitBreakerRetryPolicy circuitBreakerRetryPolicy = new CircuitBreakerRetryPolicy(new SimpleRetryPolicy(maxAttempts));
circuitBreakerRetryPolicy.setOpenTimeout(openTimeout);
circuitBreakerRetryPolicy.setResetTimeout(resetTimeout);
springRetryConfigBuilder.retryPolicy(circuitBreakerRetryPolicy).build();

But it failed since SpringRetryConfigBuilder wraps it inside another CircuitBreakerRetryPolicy hardcoded w/ default timeouts.

So the only possibility to customize the timeouts I see here is to implement my own whole new SpringRetryCircuitBreakerFactory...

Describe the solution you'd like
A simple & intuitive way to customize openTimeout&resetTimeout.

Describe alternatives you've considered

  1. New APIs in org.springframework.cloud.circuitbreaker.springretry.SpringRetryConfigBuilder to set openTimeout&resetTimeout, or...
  2. org.springframework.cloud.circuitbreaker.springretry.SpringRetryConfigBuilder#retryPolicy should smartly recognize incoming CircuitBreakerRetryPolicy & stop wrapping it in the hardcoded CircuitBreakerRetryPolicy in that case.

Additional context
n/a

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions