-
1. Re: Observing in Arquillian, event not propagated to injected bean
young_matthewd Dec 20, 2013 4:38 AM (in response to young_matthewd)If I put a conditional observes on the Receiver and set it as ApplicationScoped then the event is never propaged:
public void catching(@Observes(notifyObserver=Reception.IF_EXISTS) DummyEvent event) {.....
With non-conditional (Reception.ALWAYS) it looks like a Receiver bean is created for every event fired. Not what I expected nor do I understand why the injected receiver bean never has it's observing method called?
Putting Singleton on the Receiver gives the correct behavior except I would love not to be restricted to a singletone.
-
2. Re: Observing in Arquillian, event not propagated to injected bean
rhanus Jan 5, 2014 3:35 PM (in response to young_matthewd)What I don't get is why the receiver hash codes differ and the event is NOT propagated to the injected Receiver bean in the Example JUnit. Rather the event is sent to some OTHER receiver bean.
Has this something to do with scope (which should be the default @Dependent)?
definitely both receiver and sender beans are of dependent scope so that observer method is called on a different bean
-
3. Re: Observing in Arquillian, event not propagated to injected bean
rhanus Jan 5, 2014 3:42 PM (in response to young_matthewd)If I put a conditional observes on the Receiver and set it as ApplicationScoped then the event is never propaged:
public void catching(@Observes(notifyObserver=Reception.IF_EXISTS) DummyEvent event) {.....
that's correct because receiver bean is not called before the delivery of a event
if you called receiver bean before firing the event /* receiver.getMessage() */ then it would work fine
With non-conditional (Reception.ALWAYS) it looks like a Receiver bean is created for every event fired. Not what I expected nor do I understand why the injected receiver bean never has it's observing method called?
if receiver bean is of application scope then this scenario should wotk
-
4. Re: Observing in Arquillian, event not propagated to injected bean
rhanus Jan 5, 2014 2:00 PM (in response to young_matthewd)see a very similar working sample here