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

Pete Muir pmuir at redhat.com
Fri Apr 9 05:37:54 EDT 2010


Tricky situation, and something we "fixed" in Seam by having a transient conversation always active. I have a feeling that is what CDI should do to.

On 25 Mar 2010, at 16:49, Mark Struberg wrote:

> 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 
> 
> _______________________________________________
> weld-dev mailing list
> weld-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/weld-dev




More information about the weld-dev mailing list