[cdi-dev] [JBoss JIRA] Commented: (CDI-4) Need a way to provide ordering for Event observers (@Observes)
richardhightower at gmail.com
Sat Apr 30 16:48:04 EDT 2011
There are other event system (swing events, spring application context events) when order does not matter. So why does CDI events need order? I can see why cdi extensions need order very clearly. That said, I'd love to some use cases for this and to wonder what the API and annotation would look like. Personally I don't think it is something that should be generalized by the framework (less is more, edge case, better handled with application logic, bloat avoidance, etc.)
Sent from my iPad
On Apr 29, 2011, at 4:50 PM, "Dan Allen (JIRA)" <jira-events at lists.jboss.org> wrote:
> [ 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
> cdi-dev mailing list
> cdi-dev at lists.jboss.org
More information about the cdi-dev