[weld-dev] proper handling of Events for beans in inactive Contexts?

Mark Struberg struberg at yahoo.de
Thu Mar 25 12:49:27 EDT 2010


Hi!

I have the following scenario:

*) A ServletFilter fires a UserLoggedInEvent 
*) A @ConversationScoped MyBean @Observes UserLoggedInEvent with Reception.ALWAYS

The problem here is that the Conversation is not yet 'opened' at the time the ServletFilter fires that event. Thus ConversationContext.isActive() == false and I cannot create this bean. 

A similar situation appears if you try to send an event to a @ViewScoped bean from a JSF phase where the ViewMap doesn't yet exist.

So since there is no way to create a contextual instance, the obvious solution is to not send the notification to this very bean.

I didn't find this covered in the spec and I don't yet see much we can do in this case. This may cause some not so obvious behaviour and user may wonder why they don't get the event.

So, should we log some info in this case or silently swallow it?


txs and LieGrue,
strub


__________________________________________________
Do You Yahoo!?
Sie sind Spam leid? Yahoo! Mail verfügt über einen herausragenden Schutz gegen Massenmails. 
http://mail.yahoo.com 



More information about the weld-dev mailing list