Does resilience4j block threads while waiting for retry

118 views Asked by At

I am using resilince4j+spring boot to retry in case of api call is failed. I have a doubt of which I am not able to find relevant answer , while waiting for retry ? Suppose if I am using exponential back off time 5,10,20,40sec then one thread will be blocked ? Adding my config for better understanding of my configuration

   IntervalFunction randomWaitInterval = IntervalFunction
              .ofRandomized();  
      
    RetryConfig retryConfig =
        RetryConfig.custom()
            .maxAttempts(ccmReader.getCustomerApiProperties().getMaxRetryAttempts())
            .waitDuration(Duration.ofMillis(ccmReader.getCustomerApiProperties().getWaitDuration()))
                .retryExceptions(
                        HttpServerErrorException.class,
                        TimeoutException.class,
                        BadRequest.class
                )
            .intervalFunction(randomWaitInterval)       
            .build();

    retryRegistry
        .getEventPublisher()
        .onEntryAdded(
            entryAddedEvent -> {
              entryAddedEvent
                  .getAddedEntry()
                  .getEventPublisher()
                  .onEvent(event -> log.info(event.toString()));
            });

    return retryRegistry.retry(ServiceConstants.CUSTOMER_API_RESILIENCE_SERVICE, retryConfig);
0

There are 0 answers