Skip to Main Content
Return to Navigation

Understanding Event Handlers

Business events are the functions in a business environment, such as adding a person, changing an employee’s compensation rate, terminating an assignment, promoting an employee, and so on. After the events are created, you register events in the Event Registry component. Event handlers are modules of business logic that react to instances of particular events to which they are registered. You must register event handlers to events so that the Event Manager framework executes the event handlers whenever the event is raised.

You can assign multiple event handlers to a single business event, and you can assign a single event handler to react to multiple events. When defining events in the Event Registry component, you can assign event handlers to function in either synchronous mode or asynchronous mode with respect to the process that raises the associated event. When a process raises a registered event, the Event Manager framework determines whether the event handlers that are registered to that event are synchronous or asynchronous. If an event handler is synchronous, the Event Manager framework executes that event handler inline as part of the process that raises the event. If the event handler is asynchronous, the Event Manager framework executes the event handler as a detached process that is out of the critical path of the mainline process. You can register both synchronous and asynchronous event handlers concurrently to the same event. The Event Manager framework executes the registered event handlers in whichever mode you configure them to operate, always executing synchronous event handlers first. When defining event handlers for registry in multiple events, you should include some code in the event handler to examine the Name property of the passed-in event object so that you know which type of event caused the event handler to be executed.

The Event Manager framework is based upon a simple notify and respond model. For the notification side, the Event Manager framework broadcasts that event has occurred, along with the data that caused the creation of the event instance. For the respond side, the individual applications link business logic into the Event Manager framework to respond to the business event. By linking PeopleTools Application Classes to the event in the Event Registry component, the Event Manager framework knows when to execute the registered event handlers for the event when the event is raised.

An event handler that fails during execution causes a disruption to the execution of any other event handlers for that event or the mainline process. The Event Manager framework therefore provides many options for monitoring and troubleshooting event handlers and events. You can monitor event instances and the executions and exceptions of the event handlers through the Event Monitor component or the Event Summary component. You can also test event handlers and events outside of the mainline business process through the Handler Tester component and the Event Tester component.

Local and Remote Nodes

The Event Manger framework enables you to manage events that have influence over more than one database instance. You can use the Event Manager framework to process business events that occur on either a local or remote database (also called a node). A remote node can execute only event handlers that are implemented locally and registered to events in its local event registry. For example, an event that is raised in an HCM database might be important to a separate PeopleSoft Enterprise Learning Management (ELM) database or a PeopleSoft Financials database.

The Event Manager Framework is currently not integrated with the Service Oriented Architecture (SOA) distributed registry. Instead, each database has its own local event registry. Within a local event registry, you can define events that you can raise by local process as well as events of interest to applications on the local database that are raised by remote databases. To support the processing of an event in a remote database, remote databases must implement the Event Manager framework. Also, each local event registry must contain entries for the remote events of interest along with their associated local event handlers.

From the perspective of the Event Manager framework, virtually no difference exists between the way that asynchronous handlers are supported for remote events and local events. You register event handlers to events in the event registry, configuring the Event Manager framework to execute event handlers for events that are raised in the local database, a remote database, or both types of databases. Thus, a single event handler can respond to instances of the same event that are raised on the local database as well as a remote database.

Event handlers for remote events are by definition asynchronous. Thus, on the local database the Event Manager framework executes these remote events only after completing the execution of synchronous handlers that you have registered for the event.

Example: Local Event with Synchronous Event Handlers

Image: Local event with synchronous handlers

This example illustrates the processing of a mainline business process on a local database using an event with two registered synchronous event handlers. In this scenario, the mainline business process calls the application program interface (API) for the Event Manager framework to raise the event. The framework executes inline the two event handlers in order, publishes the generic PeopleTools Integration Broker event message, and then returns processing control back to the mainline business process.

Local event with synchronous handlers

Example: Local Event with Asynchronous Event Handlers

Image: Local event with asynchronous handlers

This example illustrates the processing of a mainline business process on a local database using an event with two registered asynchronous event handlers. In this scenario, the mainline process calls the API for the Event Manager framework to raise the event. The framework immediately publishes the generic PeopleTools Integration Broker event message, and returns processing control back to the mainline process without delay. A normal PeopleTools Integration Broker local subscription picks up the generic event message and invokes the framework to execute the asynchronous event handlers that are registered to the event.

Local event with asynchronous handlers

Example: Local Event with Both Synchronous and Asynchronous Event Handlers

This example illustrates the processing of a mainline business process on a local database using an event with two registered synchronous handlers and two registered asynchronous event handlers. In this scenario, the mainline process waits while the Event Manager framework executes the synchronous event handlers. The Event Manager framework executes the asynchronous event handler as detached processes launched by the local subscription to the generic PeopleTools Integration Broker event message.

Example: Remote Event

Image: Remote Event

This example illustrates event processing that spans across local and remote databases.

In Registry A, the event has both registered synchronous and asynchronous event handlers. The event handler that is registered to this event is set for a local source. When the event in raised in Registry A, the Event Manager framework logs the event (if it is configured for logging), publishes the generic event message, executes synchronous event handlers that are registered to the event, and then subscribes locally to the generic event message to execute asynchronous event handlers that are registered locally to the event.

Registry B has the same event active in its local event registry. The event handler that is registered to this event is set for a remote source. Because Registry B subscribes remotely to the same event message that Registry A publishes, Registry B logs the occurrence of the event and then executes the registered asynchronous handler.

Remote Event