Conflict Resolution and Run to Completion Cycles
To design rules more effectively, you need to understand what triggers rules to execute, and why a rule may not execute.
A run to completion, or RTC, cycle generally begins when an external action causes changes to the Rete network. It ends when there are no more rule actions to execute as a result of that initial change (and any subsequent changes caused by rule actions). This is also known as forward chaining, or inferencing.
During one RTC, changes can occur in the Rete network, but no new external actions can affect it.
One RTC is composed of one or more conflict resolution cycles. A conflict resolution cycle begins when TIBCO BusinessEvents builds (or refreshes) a rule action agenda, a list of all rules that are eligible to fire. The agenda is used to determine which rule action to execute next. The agenda is built based on the following information:
- The scope and conditions of the rules in the project.
- The current contents of the Rete network.
One conflict resolution cycle ends when a rule action is executed (or the agenda is empty). If the rule action changes the contents of the Rete network, another conflict resolution cycle begins.
- The rule action does not change the Rete network and TIBCO BusinessEvents executes the next rule entry in the agenda (if there is one).
OR
- The rule action does change the Rete network and TIBCO BusinessEvents refreshes the rule action agenda (see next section).
Next conflict resolution cycle
- Rules that have become newly true are added to the agenda.
- Rules that have become false are dropped from the agenda.
- Rules that were newly true at the last conflict resolution cycle and are still true remain in the agenda. (In other words, rules are newly true for the duration of the run to completion cycle unless they become false.)
As a result, either the agenda is empty and the RTC ends, or the first rule in the refreshed agenda is executed, ending this conflict resolution cycle and beginning the next one.
An empty agenda marks the end of one RTC
- Events are sent to destinations.
- Cache OM: Changes are saved to the cache and written to the backing store.
- Cache OM, Cache Only mode: All Cache Only objects are removed from the Rete network.
- Store OM: Changes are saved to the store.
- Store OM, Store Only mode: All Store Only objects are remove from the Rete network.
- Profiler: profiler data is updated.