Behaviour of methods returning CompletionStage with and without @Asynchronous
See original GitHub issueIt is not clear what’s the difference, in the expected behavior, when returning a CompletableFuture from a method annotated with @Asynchronous
and from a method without that annotation.
Examples:
import org.eclipse.microprofile.faulttolerance.Asynchronous;
@Asynchronous
public CompletionStage<String> serviceA() {
CompletableFuture<String> future = new CompletableFuture<>();
...
return future;
}
public CompletionStage<String> serviceA() {
CompletableFuture<String> future = new CompletableFuture<>();
...
return future;
}
This is especially important when we are using the @Retry
annotation in the methods.
What will happen when a retry is performed in both serviceA() and serviceB()?
Issue Analytics
- State:
- Created 5 years ago
- Comments:5 (5 by maintainers)
Top Results From Across the Web
CompletableFuture practical guide | by Yurko - Medium
A Future represents the pending result of an asynchronous computation. And CompletionStage is a promise. Promise that computation will be done ...
Read more >java - How to return CompletionStage<Response> both ...
You can create and return a completed CompletableFuture , which implements the CompletionStage using the CompletableFuture. completedFuture ...
Read more >Write Clean Asynchronous Code With CompletableFuture ...
Assume we want to find firstName of five different users and combine the results.The CompletableFuture.allOf static method allows to wait for ...
Read more >20 Practical Examples: Java's CompletableFuture - DZone
A CompletableFuture is executed asynchronously when the method typically ends with the keyword Async; By default (when no Executor is ...
Read more >CompletableFuture (Java Platform SE 8 ) - Oracle Help Center
Returns a new CompletionStage that, when either this or the other given stage complete normally, is executed using this stage's default asynchronous execution ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Method without
@Asynchronous
annotation returning CompletionStage will not be retried even ifRetry
annotation is specified and the completionStage is completed exceptionally, which is the previous behaviour.In the above method, the serviceA returned exceptionally will not be retried.
@brunobat @carlosdlr @Azquelt agreed the above statement on 19th Dec.