I have an Enterprise Application (EAR) archive containing several backend modules (EJB), as well as some web modules (WAR).
An event is fired inside one of the internal modules:
@Inject private Event<MyEvent> myEvent; ... public void fireEvent() { myEvent.fire(new MyEvent()); } ...
This can be seen in any of the other backend modules with code similar to this:
public void listener(@Observes MyEvent myEvent) { .. }
But I can not get the event inside the WAR. Is it because of the visibility of the classloader (classes from WAR are not visible by EJB) or is CDI handling this?
If CDI cannot be used for large-scale application events, what are the alternatives?
Is there anything that works with CDI? Maybe some CDI extension that combines events in a WAR?
----------- EDIT:
I can watch the event if it is fired inside the same WAR. I also tried using @Stateless bean as an event listener without success.
Packaging is as follows:
- EAR
- WAR (event must be marked here)
- WAR
- EJB (event triggered here)
source share