Beans may produce and consume events. This facility allows beans to interact in a completely decoupled fashion, with no compile-time dependency between the interacting beans. Most importantly, it allows stateful beans in one architectural tier of the application to synchronize their internal state with state changes that occur in a different tier.
An event comprises:
- A Java object - the event object;
- A set of instances of qualifier types - the event qualifiers
copied from cdi tutorials
Was described the second one. Used the qualifier NotificationByType.java for dynamic choosing which observer will be invoked. All observers are in observers package. For testing, you can use a simple controller which fire different Notification.java related on notification type.