Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Retry on result (not just on exception) #1000

Closed
Ladicek opened this issue Apr 4, 2024 · 0 comments · Fixed by #1007
Closed

Retry on result (not just on exception) #1000

Ladicek opened this issue Apr 4, 2024 · 0 comments · Fixed by #1007
Assignees
Milestone

Comments

@Ladicek
Copy link
Contributor

Ladicek commented Apr 4, 2024

Sometimes, it is necessary to retry on a non-exceptional result (such as null or Optional.empty()). This should be fairly simple to implement, API design is the most problematic concern.

Programmatic API: this one is fairly simple, add a method whenResult(Predicate<T>) to the RetryBuilder. Possibly also rename when() to whenException() to better highlight what's going on. It is not obvious what to do if whenResult() is called and when[Exception]() isn't (and possibly retryOn() / abortOn() is).

Declarative API: we cannot do anything else but add a 2nd annotation. @RetryOnResult seems like a good name. It is not obvious how to define the predicate. Probably start small and add a single member Class<Predicate<Object>> value().

@Ladicek Ladicek self-assigned this Apr 9, 2024
@Ladicek Ladicek added this to the 6.3.0 milestone Apr 9, 2024
@Ladicek Ladicek mentioned this issue Apr 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant