When a Debit event is asserted into working memory, the engine checks the ApplyDebit rule because it has a Debit event in its scope. The engine checks the rule conditions. If working memory contains an Account concept instance whose ID matches the ID in the debit, the rule is eligible to execute. When the rule executes, if the account status is not “Suspended,” the rule action debits the account instance by the amount specified in the Debit event.
What is a rule set? A rule set is a collection of rules. Rules must belong to a rule set so that when you build the project EAR for deployment, you can select which rule sets to include, and you can select different rule sets to be used in different rule sessions (inference agents). Rule functions, on the other hand, do not belong to rule sets. A rule function is available in all rule sessions (inference agents).
What are rules and how are they created? Rules define actions to take when certain conditions are met. Rules are written in the BusinessEvents rule language, which is similar to the Java language. Rules are declarative and are generally narrow in scope. The rule editor UI has three panels: the Declaration panel, the Conditions panel, and the Actions panel, which you will use in the next task.
How are rules used at runtime? The rule engine checks all changes and additions to working memory and evaluates or reevaluates rules, using their Declaration and Conditions as appropriate. Eligible rules are added to the rule agenda.
What is the rule agenda A rule fires when it is at the top of the agenda. The engine determines the order of firing using rule declarations and conditions, and each rule’s priority. As the contents of working memory change, the engine reevaluates rules and removes any that are no longer eligible to fire. See
Understanding Conflict Resolution and Run to Completion Cycles in
TIBCO BusinessEvents User’s Guide for details.
The Priority setting is used by the runtime engine when determining the order in which rules are fired. Those with a number closer to one fire first. When there is no reason to force rules to execute in a particular order, leave the Priority set to the default and let the runtime engine determine rule order.
Declaration The Declaration provides the scope of the rule. It lists all the entity types to be used in the rule, and their aliases. By default the alias is set to the entity name, but you can change it as desired.
In this task you have seen how to configure rules using the rule editor. The next task continues the activity of rule building. You will define the rule that implements the fraud detection tests.