-
Notifications
You must be signed in to change notification settings - Fork 26
Get last exception #83
Comments
@jflefebvre06 - You can already check the last exception that generated a retry by looking in the |
No, Status is not accessible from public interface BackoffStrategy {
Duration getDurationToWait(int numberOfTriesFailed, Duration delayBetweenAttempts);
default void validateConfig(RetryConfig config) {}
} |
Could you share an example of what you're trying to get access to? Do you have your own custom |
The use case is to manage http too many requests Duration getDurationToWait(int numberOfTriesFailed, Duration delayBetweenAttempts) {
if(exception.getHttpStatus()==429)
return Duration.ofMinutes(1);
else
return Duration.ofSeconds(2);
} |
@jflefebvre06 ok I understand... you want to be able to have more granular retry control over a single callable. Retry4j does not support this type of case at the moment. I'm not sure that implementing it inside a backoff strategy would be the correct approach... a better design would probably be to allow multiple retry configurations for a single callable, so that different configs could handle different exception types or return values. Please feel free to take a shot at an implementation and open a PR if you would like. Let me know if you want to discuss the design further before you do so. Thanks! |
Could you please add a way to get the last exception from a BackoffStrategy.
The text was updated successfully, but these errors were encountered: