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

Mark Struberg (JIRA) jira-events at lists.jboss.org
Sun May 8 15:58:18 EDT 2011


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

Mark Struberg commented on CDI-4:
---------------------------------

> I'm struggling to see how my proposal introduces coupling. 
If I understood correctly, then your proposal relies that you have to know the other/all the other observer(s) in your 'before' Observers. If you don't call this coupling, well...


> If I add a jar in the future which 
and what if you add another jar with another bean having another @Observes BusEvent? How to make sure your beforeInit also runs _before_ this new observer? 

Really, go back to the Portland Pattern Repository or the GoF Design Patterns book and check the Observer/Observable pattern. The whole idea/mechanism is built based on the paradigma that all the involved parties know NOTHNING about each other. 

Having some hardcoded before/after stuff is imo really just an obfuscated method call without any further aid.


> 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