Define AccountOperation, Create, Debit, and Enable 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® Extreme 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.

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® Extreme (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.)

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.

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® Extreme Application Architect’s Guide for more details.

Why do the events have a warning sign? Just as destinations generally have default events, events generally have default destinations. The warning is to alert you to the fact that an event has no default destination. In this case, however, no events are sent out through channels so no default is required.

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 the Create, Debit, and Enable events. You’ll see why in a later section.

[Note]

See Channels and Events in TIBCO BusinessEvents® Extreme Application Architect’s Guide for overview and conceptual information.

See Simple Events, Time Events, and Scheduler Functions, and Advisory Events in TIBCO BusinessEvents® Extreme Application Developer’s Guide for implementation details.

Define the AccountOperations Event

This event is a parent to events that are used in the project. It has one property: identifier. 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. In the Default Destination field, click the browse button and in the Select Destination dialog, select FraudDetection/Channels/HTTP.channel/AllOperations. Click OK.

  4. You see the Simple Event Editor. In the Properties section, click the Add button. Click in the cell under Name and type the name identifier.

    This property is a String property, and String is the default type.

  5. Save and close the resource.

Define the Create Event

For example purposes, the information needed to create an account is an identifier, a balance, and a monthly average balance (for the fraud detection calculation). The identifier 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 Create. 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 Create one.

  4. In the Default Destination field, click the browse button and in the Select Destination dialog, select FraudDetection/Channels/HTTP.channel/AllOperations. Click OK.

  5. In the Properties section, add two properties:

    • balance, of type double

    • averageMonthlyBalance, of type double

  6. Save and close the resource.

[Tip]

In any editor, you can click any label that is underlined (such as Inherits From in the Event editor) to open the resource selected for that setting.

Define the Debit Event

Following the procedure above, add the Debit event with the values in Table 2.1, “Debit Event”.

Table 2.1. Debit Event

FieldValue
NameDebit
DescriptionSpecifies an account and a debit amount.
Inherits FromAccountOperations
Default Destination/Channels/HTTP.channel/AllOperations
Propertiesamount (double)

The Debit event should look like this when it is complete.

Define the Enable Event

Following the procedure above, add the Enable event with the values in Table 2.2, “Enable Event”.

Table 2.2. Enable Event

FieldValue
NameEnable
DescriptionRe-enable an account and reset the balance.
Inherits FromAccountOperations
Default Destination/Channels/HTTP.channel/AllOperations
Propertiesbalance (double)

The Enable event should look like this when it is complete.

Summary and Next Steps

Next you will continue to configure the project ontology by defining concepts.