HomeGuidesChangelog
GuidesGitHubLog In

Examples

Examples of resilience4j-retry

Fix typo

Create a RetryRegistry

Create a RetryRegistry with a custom RetryConfig.

RetryConfig config = RetryConfig.custom()
    .maxAttempts(2)
    .waitDuration(Duration.ofMillis(100))
    .retryOnResult(response -> response.getStatus() == 500)
    .retryOnException(e -> e instanceof WebServiceException)
    .retryExceptions(IOException.class, TimeoutException.class)
    .ignoreExceptions(BusinessException.class, OtherBusinessException.class)
    .build();
    
// Create a RetryRegistry with a custom global configuration
RetryRegistry registry = RetryRegistry.of(config);