Event Module

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.

Downloads

View Source: https://github.com/openmrs/openmrs-module-event
Checkout Source: https://github.com/openmrs/openmrs-module-event
Download: https://addons.openmrs.org/#/show/org.openmrs.module.event

Technical Documentation

Possible Actions

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:

Event.subscribe(Class, String, EventListener); // The String argument can be any of the values in the Event.Action Enum or Event.setSubscription(SubscribableEventListener); // spring callable, see below

or in your Spring moduleApplicationContext:

<bean class="org.openmrs.eventbus.Event"> <property name="subscription"><bean class=&q