Open topic with navigation

TIBCO BusinessEvents® Enterprise Edition 6.3.1

# Adding the CreateAccount Rule

The `BadCreateAccount` rule has a higher priority, so it will fire before the `CreateAccount` rule.

Procedure
1. Right-click the Rules folder again, and select New > Rule.
2. In the New Rule Wizard Rule name field, type `CreateAccount`.
3. Click Finish.
4. In the Form tab, set the Priority field to `5`. (This is a lower priority than the `BadCreateAccount` rule.)
5. Drag the `CreateAccount` event from the TIBCO BusinessEvents Studio Explorer tree into the first empty row in the Declaration section.

   This rule has no conditions — the `BadCreateAccount` rule means there is no need. You could have combined the two rules into one. There are many ways to write rules for a project. You have to use your judgment.

   In the Actions panel, you’ll use an ontology function to create the Account concept instance. You can also get to ontology functions using the function catalog.

6. From the top menu select Window > Show View > Other > TIBCO BusinessEvents > Catalog Functions.
   The Catalog Functions view displays on the right (unless your Eclipse IDE is configured differently — it could display along the bottom, for example).
7. Below each concept, event, and rule function is its ontology function. Expand Ontology Functions > FraudDetection > Concepts > Account > Account:

8. Drag the Account function into the Actions section.
   You see its signature:

       Concepts.Account.Account(/*extId String */,/*Balance double */,/*Debits double */,/*Status String */,/*AvgMonthlyBalance double */)

9. Configure the function to create the Account concept, and type the rest of the actions as follows. You can double-click the tab to expand the rule editor, to make rule writing easier.

           Concepts.Account.Account(createaccount.AccountId/*extId String */,
                     createaccount.Balance/*Balance double */,
                     0/*Debits double */,
                     "Normal"/*Status String */,
                     createaccount.AvgMonthlyBalance/*AvgMonthlyBalance double */);
           Event.consumeEvent(createaccount);
           System.debugOut("#### Created account " + createaccount.AccountId);

10. Save and close the resource.
    Note that in this case it is not really necessary to consume the event. No other rules have this event in their scope.

Result

Events with time to live (TTL) set to zero (0) are consumed at the end of an RTC. However, it does no harm and makes the rules more consistent, reducing chances of error.

Did you find this helpful?

YesNo
Great!
Thanks for taking the time to give us some feedback.
Sorry about that

Why wasn't this helpful? (check all that apply)

Could not find what I was looking for
Instructions confusing or unclear
Instructions did not work

Want to tell us more?

Please select at least one option or provide details about the issue!!

Error occurred while submitting feedback.

Error2 occurred while submitting feedback.

TIBCO BusinessEvents® Enterprise Edition

Copyright © 2004-2024. Cloud Software Group, Inc. All Rights Reserved.