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

Matej Novotny (JIRA) issues at jboss.org
Mon Jun 18 09:04:01 EDT 2018

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

Matej Novotny commented on CDI-729:

Chaining can be done from the event-firing side, but the loose coupling is intentional. Observers often don't know about other observers as they may come from different bean archives.

What you are trying to do could be done, for instance, with interceptors which seem a good match for logging after certain action was performed.
But I suppose you are mainly trying events because they can be asynchronous. If that's the case, what Martin says is probably the go-to way and can be achieved 'natively'.

> 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

More information about the cdi-dev mailing list