Project Design Tutorial : Define the AccountOperation, CreateAccount, Debit, and Reply Events

Define the AccountOperation, CreateAccount, Debit, and Reply Events
In this task, you begin to build the project ontology by defining some events — or strictly speaking, event types. Before you define event types in a real-world project, you first examine the incoming and outgoing messages, as well as messages that you want to occur within the application, and configure each event type’s characteristics accordingly. You can use inheritance (as demonstrated here) to simplify configuration.
TIBCO BusinessEvents provides various kinds of events. Simple events are used in this tutorial to bring messages into the application. In addition you can use SOAP events, time events and advisory events, which you can learn about in the product documentation.
Learning Points
What is an event?  The term event is overloaded: it means an activity that happens, and the definition of an object that represents the activity in TIBCO BusinessEvents (an event type), and an instance of that event type definition.
How are events (event instances) created?  Simple event types are created at design time. Event instances are generally created using data in incoming messages. When a destination receives a message, it creates an event to hold the information from the message. Events from channels are automatically asserted into the Rete network, where their presence generally triggers rules (if all rule conditions are met).
Simple events can also be created by rules and rule functions. Events created this way are not asserted automatically because they could be intended for use as outbound events, to be sent to a destination. You must explicitly assert such internally created events as needed.
What is an event payload?  Just as messages have properties and a message body, events can have properties and payloads. The payload is optional. It is used to hold more complex data, for example, SOAP messages. (The events in this example do not use a payload.)
What is a default destination?  Outbound events of the same event type are often sent to the same destination. To simplify the process of sending those events, you can specify a default destination in the event type.
Why do the events have this warning sign?   The yellow triangle with exclamation point means something may not be right. A red triangle means there is an error. The yellow triangle is shown for events with no default destination. In this case, however, no events are sent out through channels so no default is required.
What is a default event?  The default event configured for a destination is used to hold information transferred from an incoming message, when no event type is specified in the message.
See Default Destinations and Default Events in TIBCO BusinessEvents Architect’s Guide for more details.
Rules that apply to a parent type also apply to its child types  Concept and event types use inheritance in a similar way to Java classes. Because rules that apply to a parent type also apply to its child types, it is generally not advisable to create many levels of inheritance. However it can be a useful technique. In this tutorial the AccountOperations event is the parent of both the CreateAccount and Debit events. You’ll see why in a later section.
More Information
Chapter 2, Channels and Events in TIBCO BusinessEvents Architect’s Guide for overview and conceptual information.
Chapter 8, Simple Events, Chapter 9, Time Events and Scheduler Functions, and Chapter 10, Advisory Events in TIBCO BusinessEvents Developer’s Guide for implementation details.
Task D Define the AccountOperations Event
This event is a parent to events that are used in the project. It has one property: AccountId. All its child events inherit this property, and extend the parent by adding more.
1.
Right click the Events folder, and select New > Simple Event.
2.
You see the New Simple Event Wizard. In the Simple Event Name field, type AccountOperations. In the Description field, type Parent event for all account-related events. Click Finish.
3.
You see the Simple Event Editor. In the Properties section, click the Add button. Click in the cell under Name and type the name AccountId. It’s a String property, and String is the default type.
4.
Task E Define the CreateAccount Event
For example purposes, the information needed to create an account is an ID, a balance, and a monthly average balance (for the fraud detection calculation). The ID property is inherited from the AccountOperations event.
1.
Right click the Events folder, and select New > Simple Event.
2.
In the New Simple Event Wizard Filename field, type CreateAccount. In the Description field, type Triggers the CreateAccount rule to create an account. Click Finish.
3.
In the Simple Event Editor Inherits From field, click Browse. In the upper section of the event picker, select the Simple Event event type, and in the lower section browse to and select the AccountOperations event. Click OK. The AccountOperations event is now the parent event for the CreateAccount one.
4.
In the Default Destination field, click the browse button and in the Select Destination dialog, select /Channels/HTTP.channel/AllOps. Click OK.
5.
In the Properties section, add two properties:
Balance, of type double
AvgMonthlyBalance, of type double
6.
In any editor, you can click any label that is underlined (such as the Inherits from label in the Event editor) to open the resource selected for that setting.
Task F Define the Debit Event
Following the procedure above, add the Debit event:
Description (Defined in the wizard and editor)
Amount (double)
Task G Define the Unsuspend Event
Following the procedure above, add the Unsuspend event:
Description (Defined in the wizard and editor)
Triggers the UnsuspendAccount rule to change the customer status from Suspended to Normal
Summary and Next Steps
Next you will continue to configure the project ontology by defining a concept.