Basic components of the Application Event System
The application event system consists of these interrelated components:
- Application events are uniquely named incidents that can occur during the use of an application. These events can have multiple triggers and can be generated by user actions, conditions in a database, other events, or other situations.
- Event handlers consist of data that specifies:
- The application events to which they are to respond
- Any conditions, situations, or attributes that determine when and why each handler executes
- One or more event actions to take place during the handler’s execution
Each application event can have multiple handlers, but each handler can be associated with only one application event.
- Event actions consist of instructions that specify the individual tasks or bits of work that are performed by the event handler. Each event handler must have at least one action and can have multiple actions.
This diagram shows a possible set of application events, event handlers, and event actions:
![AES Basic Components](iuh1500870203815.png)
Suppose you want the system to automatically notify you whenever someone adds a customer order to the system and to request your approval if the order is $1000 or more.
This diagram shows the application event and associated handlers for this scenario:
![AES Example](xph1500870526171.png)
The application event gets triggered whenever someone creates a new customer order. The application event that tells the event handler to run are set up as part of the event handler definition. The event action is a notification that an order has been placed and an approval request for orders of $1000 or more.
A single event handler is required, but that event handler requires these event actions to complete all the requirements:
- Event Action 1: The system checks the amount of the order and
determine what additional actions are required based on the amount.
- If the amount is $1000 or more, go to Event Action 2.
- If the order is less than $1000, go directly to Event Action 3.
- Event Action 2: The system generates a prompt message to the
manager to request approval for the order. The system then waits until the
manager responds.
- If the manager approves the order, the system then proceeds to the next action.
- If the manager disapproves the order, the event handler fails and no further action is taken.
- Event Action 3: The system sends a message to the inbox with a notification to let the manager know that the order has been completed.