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

Jason Porter (JIRA) jira-events at lists.jboss.org
Sun May 8 17:11:18 EDT 2011


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

Jason Porter edited comment on CDI-4 at 5/8/11 5:10 PM:
--------------------------------------------------------

bq. Simply having say, a framework like Forge implement comparators, doesn't help readability of the model at all. In fact, it sort of suffers from the same problem that putting the configuration in an XML file suffers from: you can't get any sense of the ordering just by looking at any given observer.

Yeah, that is one of the side effects of this idea. 

Seems two issues we're be dealing with are 
# adding to the signature of the observer, possibly making it harder to read with other annotations
# externalizing ordering and not having any idea about ordering simply by looking at an observer.

With a comparator, you could do what you wanted with the extra annotations, they simply wouldn't be qualifying annotations, you could do the ordering in the comparator based on those. Another option I just thought of (which is similar to the comparator idea) is to make handling observers pluggable. Call it an EventingBus or something, it would be another SPI that people could tie into and have (full ?) control over how eventing happens, ordering, injection points, etc. This idea would allow us to do what we wanted in Seam JMS (not sure if this has come up in CODI) where we need the metadata of the event that was fired. It would be more work for the end user should they decide to take it, but it really gives them control over the application, and the environment should they need it.

Sorry for the first post which wasn't complete, Save and preview were a little too close :)

      was (Author: lightguard):
    bq. Simply having say, a framework like Forge implement comparators, doesn't help readability of the model at all. In fact, it sort of suffers from the same problem that putting the configuration in an XML file suffers from: you can't get any sense of the ordering just by looking at any given observer.

Yeah, that is one of the side effects of this idea. Seems the two issues we'll be dealing with are 
1. ao
  
> 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