Distributed Events

Concordia includes a distributed events framework that enables objects (e.g., agents) to communicate with each other either synchronously or asynchronously. Events may be used for several purposes (e.g., they are extremely useful for notifying objects of changes to resources and unexpected conditions).

Concordia provides two flavors of distributed events: selected events and group-oriented events. The event selection paradigm enables objects (e.g., agents) to define the types of events they wish to receive. In contrast, group-oriented events are broadcast to a collection of objects. Selected events are handled by a Concordia component known as the Event Manager; group-oriented events are supported by the collaboration framework discussed earlier.

Events themselves are represented by objects that derive from the abstract base class, EventType. The base class is very simple containing only a few "getters". Hence, each derived class can specialize the base class, as needed.

New Event API in V1.1

The V1.1 release of Concordia includes a new event API. The old API still exists and is appropriate for non-mobile objects. For example, an application may register to receive events via the Event Manager API. The main difference between the old API and the new one is that the new API guarantees that events are forwarded to agents as they travel from host to host. The new API is also much simpler and provides much better encapsulation. It is described in detail in this chapter. The changes introduced by the new API are listed below for those familiar with the old API:

  1. Agent developers no longer need to create EventNotifyImpl or EventQueueImpl objects for synchronous or asynchronous event notification. These objects are created by the Agent's makeEventHandler() method. This change greatly simplifies the use of event notification by agents.
  2. A new Agent method, makeEventManagerConnection() encapsulates establishing a connection with the Event Manager or creating a proxy to do so.
  3. The call to makeEventManagerConnection() creates an EventManagerConnection object that wraps all calls to the Event Manager or its proxy. Non-mobile objects may choose to use an EventManagerConnection object rather than looking up the Event Manager in the RMI registry or creating a proxy.
  4. The Agent class has new wrapper methods, registerEvents, registerAllEvents, unregisterEvents, unregisterAllEvents, and postEvent, which call into the Agent's EventManagerConnection object, which in turn call into the EventManager or a proxy.
  5. The Agent class now implements EventHandler and supplies an empty handleEvent() method. Subclasses can override this method to provide application-specific event handling.