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

James Roper (JIRA) issues at jboss.org
Tue Jun 19 11:32:00 EDT 2018

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

James Roper commented on CDI-729:

Not sure that I understand, are you saying that what I described above is already supported today? Because, at least according to the Weld documentation, the only thing an observer can return today is {{void}}.

And for back pressure, sure, the CDI implementation might be fast, but if an event handler is doing an operation on a database or remote service, and that is overloaded and taking 10 seconds to respond, how can that backpressure be propagated back to the thing that fired the event so that it doesn't continue firing events and increase the load on the already overloaded slow component? Currently, the only way is for the consumer to block the thread it's running on, that's not asynchronous.

> 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