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

Re-subscription must re-trigger the operation #10810

Conversation

cescoffier
Copy link
Member

When an operation returns a Uni, resubscribing to this Uni must re-execute the underlying operation (except if the user explicitly uses cache()).
As RestEasy uses CompletionStage behind the scene, this behavior was not working and was always returning the same CompletionStage (the initial one). As a consequence, resubscriptions and retries were not working.

This PR changes how the Unis are created to re-execute the operation on every subscription. Note that it also delays the initial execution until the first subscription.

@cescoffier cescoffier requested a review from FroMage July 17, 2020 11:50
@cescoffier cescoffier added the kind/bug Something isn't working label Jul 17, 2020
@cescoffier cescoffier added this to the 1.7.0 - master milestone Jul 17, 2020
@gsmet
Copy link
Member

gsmet commented Jul 17, 2020

Is it something that should go in 1.6.1?

@cescoffier
Copy link
Member Author

@gsmet Yes, I would consider it as a bug. However, there is a workaround, so if it's not backported it's not the end of the world. I would like the review from @FroMage as he has more knowledge on this.

@cescoffier
Copy link
Member Author

BTW, I believe that the Resteasy Single/Maybe support has the same bug.

Copy link
Member

@FroMage FroMage left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, but perhaps it's worth documenting this behaviour difference ?

@cescoffier
Copy link
Member Author

Yes, it deserves to be mentioned in the doc. I will add a sentence tomorrow.

When an operation returns a Uni, resubscribing to this Uni must re-execute the underlying operation (except if the user explicitly uses cache()).
As RestEasy uses CompletionStage behind the scene, this behavior was not working and was always returning the same CompletionStage (the initial one). As a consequence, resubscriptions and retries were not working.

This commit changes how the Unis are created to re-execute the operation on every subscription. Note that it also delays the initial execution until the first subscription.
@cescoffier cescoffier force-pushed the features/resubscription-must-reexecute-operation branch from 866f264 to 6ff0c0a Compare July 21, 2020 06:31
@cescoffier
Copy link
Member Author

@FroMage I've added a bit of text in the documentation.

@cescoffier cescoffier merged commit a507ab8 into quarkusio:master Jul 21, 2020
@cescoffier cescoffier deleted the features/resubscription-must-reexecute-operation branch July 21, 2020 09:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/documentation kind/bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants