Rules and Functions
If you are using the source editor, adapt these instructions that focus on the form-based editor and mention the equivalent settings in the source editor.
Rule Source Editor
* @description * @author */ rule Rules.ProcessDebits.ApplyDebit { attribute { priority = 1; forwardChain = true; Optionally add entry for Rank as needed (Rank=RuleFunction), or enter in Form view. } declare { Events.Debit debit; Concepts.Account account; } when { //Checks whether the extId of an Account instance in working memory //matches the incoming event's account ID account@extId == debit.AccountId; } then { //If Account Status is not Suspended, debits the account if (account.Status !="Suspended") { account.Debits=debit.Amount; System.debugOut("############### Debiting account <" +account@extId+ "> by $" +debit.Amount); account.Balance=account.Balance - debit.Amount; System.debugOut("############### New balance: $" + account.Balance); } else { System.debugOut("############### Cannot debit the suspended acount <" +account@extId +">"); } Event.consumeEvent(debit); } }
- Adding a Rule
- Rule Editor Reference
- Adding a Rule Function
Regular rule functions have arguments and a body containing the code for the function. Virtual rule functions have arguments but no body. Virtual rule functions are used only with the TIBCO BusinessEvents Decision Manager add-on software. The implementation for virtual rule functions is provided by one or more decision tables. See TIBCO BusinessEvents Decision Manager product documentation for more details. - Rule Function Resource Reference
- Using Variables and Functions in the Rule Editor
This section provides some tips on working in the rule editor. The rule editor is used for TIBCO BusinessEvents rules, rule functions, and state machine rules. - Using Priority and Rank to Control Order of Rule Execution
For each RTC, the rule agenda is sorted by priority and then within priority by rank, for those rules that use the same ranking. Use of priority and rank is optional. You can also use priority without using rank. - Using the Quick Fix Feature in the Rule Editor
The Quick Fix feature enables you to create concepts, events, and rule functions without leaving the rule editor. It also enables you to add properties to existing concepts and events. The feature is available when an unknown reference appears in the rule or rule function code. - Tips for Working in the Rule Editor
Here are some tips for working with the Rule Editor - Event Preprocessors
Event preprocessors are rule functions with one argument of type simple event. - Transaction Error Handler Rule Function
You can create a transaction error handler callback rule function that enables you to identify which post RTC transactions failed or which events were not sent out during the post RTC phase. The transaction error handler rule function is invoked each time a database transaction exception occurs, and each time a send event exception occurs.
Copyright © TIBCO Software Inc. All rights reserved.