[cdi-dev] [JBoss JIRA] (CDI-729) Async event not CompletionStage friendly

Romain Manni-Bucau (JIRA) issues at jboss.org
Tue Jun 19 12:52:00 EDT 2018


    [ https://issues.jboss.org/browse/CDI-729?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13594023#comment-13594023 ] 

Romain Manni-Bucau edited comment on CDI-729 at 6/19/18 12:51 PM:
------------------------------------------------------------------

What I'm saying is that supporting to inject the completionstage event and use the returned completion stage (which can include a database call) for the "wait completion" logic on cdi side is trivial to impl and enable a lot of cases in user land so it does worth it a lot. Exception are a simple impl of backpressure with CompletionStage, even using bulkhead (different pool) works. This is clearly out of cdi (which is good) and already handled in the jre for the basic stuff. Advanced impl will use rx, hystrix or other impl and the link to CompletionStage.

Side note: you don't block the caller thread anyway ;) and if you want to append your db call you expect to block the async thread and this is the whole goal of that ticket. In practise I expect to use NIO at the end (remote http service in my case).


was (Author: rmannibucau):
What I'm saying is that supporting to inject the completionstage event and use the returned completion stage (which can include a database call) for the "wait completion" logic on cdi side is trivial to impl and enable a lot of cases in user land so it does worth it a lot. Exception are a simple impl of backpressure with CompletionStage, even using bulkhead (different pool) works. This is clearly out of cdi (which is good) and already handled in the jre for the basic stuff. Advanced impl will use rx, hystrix or other impl and the link to CompletionStage.

> Async event not CompletionStage friendly
> ----------------------------------------
>
>                 Key: CDI-729
>                 URL: https://issues.jboss.org/browse/CDI-729
>             Project: CDI Specification Issues
>          Issue Type: Feature Request
>            Reporter: Romain Manni-Bucau
>
> The goal of this ticket is to enable user to get injected the completion future instead of the raw event and return another completion stage (generic type ignored) to enable the "chain" to be synched.
> Here is a sample:
> 1. fireAsync(persistEvent)
> 2. observer implementation does: return future.thenCompose(db::doAsyncPersist)
> 3. when the user gets back the result of the fireAsync the doAsyncPersist is completed.



--
This message was sent by Atlassian JIRA
(v7.5.0#75005)


More information about the cdi-dev mailing list