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

Dan Allen (JIRA) jira-events at lists.jboss.org
Fri Apr 29 19:50:18 EDT 2011

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

Dan Allen commented on CDI-4:

I don't really think it's counter intuitive. A special circumstance, sure. But not counter intuitive. In a stateful system, there are times when one observer is going to need to affect the state of the system in such a way that it needs to come before other observers of the same event. We have this in Servlet, we have this in JSF and I think we need to have it in CDI too.

One concrete use case is an observer that responds to the Servlet Initialized Event (assuming we had such an integration) to prepare the request and initialize other context variables so that all other observers of the same event can use these prepared resources. The inverse is needed on destroy. 

> 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
>             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