[cdi-dev] [JBoss JIRA] Commented: (CDI-4) Need a way to provide ordering for Event observers (@Observes)

Jason Porter (JIRA) jira-events at lists.jboss.org
Sun May 8 12:08:20 EDT 2011


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

Jason Porter commented on CDI-4:
--------------------------------

I mentioned InjectionPoint because ObserverMethod doesn't give you metadata of the containing bean, but we could add that if feel we need it. Otherwise ObserverMethod has the payload type, qualifiers, transaction phase, reception, etc. Seems like everything one would need to make a decision about ordering observers.

I know the spec doesn't call this out explicitly, it's more of an implementation detail, but I'm pretty sure each implementation is going to store the ObeserverMethods in some sort of Iterable (it's actually somewhat implied via the JavaDocs for BeanManager it will be a Set). Adding additional metadata or global explicit ordering seems like overkill when we have easy solutions in the JDK, we just need to expose it.

The service could be something like javax.enterprise.inject.spi.ObserverComparator, applied after the ProcessObserverMethod event. We could actually apply this idea globally to all areas we need ordering (little late for Interceptors though, unless we define a comparator that orders via the XML as a default).

> Need a way to provide ordering for Event observers (@Observes)
> --------------------------------------------------------------
>
>                 Key: CDI-4
>                 URL: https://issues.jboss.org/browse/CDI-4
>             Project: CDI Specification Issues
>          Issue Type: Feature Request
>          Components: Events, Portable Extensions
>    Affects Versions: 1.0
>         Environment: All
>            Reporter: Lincoln Baxter III
>            Assignee: Mike Brock
>             Fix For: TBD
>
>
> There needs to be a way to specify some kind of ordering for Event observers. 
> Understandably, this is somewhat counter-intuitive to the general concept of observing an event, but there is going to be need for this in an upcoming JBoss project. While it can be done manually, it might be nice to have a built-in API.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira


More information about the cdi-dev mailing list