What this module does
This module creates easy handle points for other modules to hook onto. When an event occurs in openmrs it will notify all registered/subscribed listeners.
View Source: https://github.com/openmrs/openmrs-module-event
Checkout Source: https://github.com/openmrs/openmrs-module-event
An enum on Event.Action contains the possible actions of CREATED, UPDATED, RETIRED, UNRETIRED, VOIDED, UNVOIDED, PURGED
Registering module domain objects for which to fire events
The module's domain objects must be subclasses of OpenmrsObject.
If you wish for retired/unretired or voided/unvoided events to be fired, they should implement Retireable or Voidable respectively.
To subscribe to an event
In your module activator or anywhere else in your module code:
or in your Spring moduleApplicationContext:
A SubscribableEventListener specifies the list of Classes and list of Actions that it supports.
Getting notified of an event.
The module uses apache's ActiveMQ messaging server, your EventListener class should extend EventListener and its onMessage(Message message) will be called
Unsubscribing from an event
Example Client code
- The Atom Feed Module takes advantage of this module.
- The below class should be registered to the Event class with Event.subscribe(____, new CountEventListener());
- Fixes the issue of OpenMRS hanging on startup due to incorrect activemq-data location (EVNT-31)
2.2 (broken for bean subscription, please use 2.2.1)
- Changed module so that it works via Hibernate Interceptors instead of AOP (EVNT-22)
- Handle saving of subclasses (EVNT-23)
- Added person to list of supported classes (EVNT-24)
- Handle events on Orders (EVNT-21)
- To be written after release