Copyright © TIBCO Software Inc. All Rights Reserved |
When a Debit event is asserted into the Rete network, TIBCO BusinessEvents checks rules with the Debit event in their scope.
• The ApplyDebit rule has the Debit event in its scope, and also an account ID. It’s priority 1 so it will execute before any other lower priority rule. The engine checks the rule conditions.
− If the Rete network also contains an Account instance whose ID matches the ID in the debit event, the rule executes. If the account is suspended, a message to that effect displays in the console. Otherwise, the account is debited. A message displays in the console to this effect.
− If the Rete network does not contain a matching Account instance, then other rules in the agenda — those that have debit events in their scope — are eligible to execute. BadApplyDebit is the only rule with the Debit event in its scope, so it is eligible and it executes. It sends a message to the console that no matching account is found.
• The CheckNegativeBalance rule has an Account concept in its scope. When an account is debited the Account concept is changed, and so the CheckNegativeBalance rule becomes "newly true." The effect is similar to assertion of a new entity into the Rete Network. If the debit has made the account balance negative, this rule sets the status to Suspended.It’s important to understand how conflict resolution and run to completion (RTC) cycles work. If you understand what triggers rules to execute, and why a rule may not execute, you can design rules more effectively. For a reminder, carefully reread Understanding Conflict Resolution and Run to Completion Cycles in TIBCO BusinessEvents Architect’s Guide.
• If you have completed Task L, Add the BadCreateAccount Rule and Task M, Add the CreateAccount Rule, you will be familiar with adding rules. This section shows the source code for the three rules you will add. As an extra hint, screenshot of the ApplyDebit rule is also shown belowThe main purpose for showing the form view is so you can compare it with the source view when creating your own rule.
"#### Account ID "+account@extId+" STATUS set to Suspended. Balance" +account.Balance+" is less than zero");
Copyright © TIBCO Software Inc. All Rights Reserved |