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

Add a utility method to turn a legacy throwable-based retryWhen function to a Retry #2310

Closed
simonbasle opened this issue Aug 7, 2020 · 0 comments · Fixed by #2311
Closed
Assignees
Labels
type/enhancement A general enhancement
Milestone

Comments

@simonbasle
Copy link
Contributor

simonbasle commented Aug 7, 2020

Motivation

Since 3.3.x, retryWhen(Function<Flux<Throwable>, Publisher>> is deprecated, and it is removed in 3.4.0-M2.
However, some users do still rely on reactor-extra 's reactor.retry.Retry builder, which implements Function rather than Retry.
The Retry.from(Function<Flux<RetrySignal>, Publisher>) utility method only helps halfway for a migration, because it is RetrySignal based and not Throwable based.

Desired solution

Adding a second utility adapter method, Retry.fromThrowable(Function<Flux<Throwable>, Publisher>), that performs the full adaptation.

Considered alternatives

A current way to adapt the code is to map the RetrySignal to its failure:

Function<Flux<Throwable>, Flux<Long>> retryLegacyFunction;
Retry adapted = Retry.from(rs -> rs
    .map(RetrySignal::failure)
    .transform(retryLegacyFunction));

Additional context

See reactor/reactor-addons#231 for an example of an issue where users have trouble finding the correct migration path.

@simonbasle simonbasle added the type/enhancement A general enhancement label Aug 7, 2020
@simonbasle simonbasle added this to the 3.3.9.RELEASE milestone Aug 7, 2020
@simonbasle simonbasle self-assigned this Aug 7, 2020
simonbasle added a commit to simonbasle/reactor-core that referenced this issue Aug 7, 2020
@simonbasle simonbasle linked a pull request Aug 7, 2020 that will close this issue
simonbasle added a commit that referenced this issue Aug 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/enhancement A general enhancement
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant