The
BadCreateAccount rule has a higher priority, so it will fire before the
CreateAccount rule.
Procedure
Right-click the
Rules folder again, and select
New
> Rule.
In the
New Rule Wizard Rule name field, type
CreateAccount.
Click
Finish.
In the
Form tab, set the
Priority field to
5. (This is a lower priority than the
BadCreateAccount rule.)
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.
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).
Below each concept, event, and rule function is its ontology function. Expand
Ontology Functions
> FraudDetection
> Concepts
> Account
> Account:
Drag the Account function into the Actions section.
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.
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.