[cdi-dev] [JBoss JIRA] (CDI-20) @Observes(propagate = false) - stop event propagation after being handled by an observer

Martin Kouba (JIRA) issues at jboss.org
Mon Sep 21 09:14:00 EDT 2015

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

Martin Kouba commented on CDI-20:

I'm not so sure it's a good idea to allow any observer to abort processing of an event. This would be another way to kill the original concept of decoupled interactiion. Ordering might be sometimes handy but to allow to abort the processing seems to me a bit too much. For some use cases it might be better to implement a mutable thread-safe event payload with a flag (as mentioned above) and let the observers handle this alone (e.g. the first one marks the payload as handled and others just skip the processing).

> @Observes(propagate = false) - stop event propagation after being handled by an observer
> ----------------------------------------------------------------------------------------
>                 Key: CDI-20
>                 URL: https://issues.jboss.org/browse/CDI-20
>             Project: CDI Specification Issues
>          Issue Type: Feature Request
>          Components: Events
>    Affects Versions: 1.0
>         Environment: any
>            Reporter: Walter White
>             Fix For: 2.0 (discussion)
> I would like to have the ability to stop event propagation after it is handled by any observer only for certain situations.  Is it possible to add a property to the annotation indicating whether the propagation should continue after being handled by the observer?  Alternatively, would it be more concise to add a qualifier annotation which specifies the propagation.

This message was sent by Atlassian JIRA

More information about the cdi-dev mailing list