Skip to content

Feign retries event if Retryer.NEVER_RETRY is configured in the AsyncFeign.<HttpClientContext>builder() #1966

Open
@jimartinmoreno

Description

@jimartinmoreno

Hello everyone!

We have run several tests with Feign async clients and even though we are configuring the AsyncFeign builder to not use retries. It worked correctly in most of the cases but when a HttpStatus SERVICE_UNAVAILABLE or TOO_MANY_REQUESTS is returned in the response it retries at least once:

  • org.springframework.boot:spring-boot-starter-parent: 3.0.2
  • org.springframework.cloud:spring-cloud-dependencies: 2022.0.1

Sample of code

import static feign.Retryer.NEVER_RETRY;

@Bean
    @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
    public AsyncFeign.AsyncBuilder<HttpClientContext> defaultAsyncBuilder(AsyncClient<HttpClientContext> httpClient, Decoder decoder, Encoder encoder, Contract contract, ErrorDecoder errorDecoder, GlobalFeignRequestInterceptor globalFeignRequestInterceptor) {
              return AsyncFeign.<HttpClientContext>builder()
                          .client(httpClient)
                          .decoder(decoder)
                .errorDecoder(errorDecoder)
                .encoder(encoder)
                .dismiss404()
                .retryer(NEVER_RETRY) // Disable Feign retries
                .contract(contract)
                .requestInterceptor(globalFeignRequestInterceptor);
    }
cloud:
    openfeign:
      httpclient:
        max-connections-per-route: 5
        max-connections: 20
      client:
        config:
          default:
            loggerLevel: full 
            connectTimeout: 60
            readTimeout: 300
            dismiss404: true
          productFeignClient:
            connectTimeout: 10
            readTimeout: 20
            logger-level: full

Are we missing something or is this a known or unknown issue?

Thank you in advance for your answer

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugUnexpected or incorrect behaviorspring-cloudIssues related to Spring Cloud OpenFeign

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions