Event handlers

We have already seen how to register handlers. To create an event handler one simply needs to implement the interface: curam.util.events.impl.EventHandler, which is shown below.

The action taken by an event handler when the event is raised is up to the developer. It should be noted that event handlers are invoked synchronously when the event is raised (and hence run within the same transaction context as the code raising the event). This has two implications:

Figure 1. Event handler interface
package curam.util.events.impl;

  import curam.util.events.struct.Event;
  import curam.util.exception.AppException;
  import curam.util.exception.InformationalException;

  public interface EventHandler {
    void eventRaised(Event event)
      throws AppException, InformationalException;
  }