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 Rete network changes
The first of the conflict resolution cycles is initiated by change in the Rete network, caused by an external action such as a message arriving at a destination. All subsequent changes to the Rete network during one RTC occur because of rule actions.
TIBCO BusinessEvents builds the agenda
To build the rule action agenda, TIBCO BusinessEvents examines all rules that are newly true because of the change to Rete network and compares them with rule dependencies. The agenda’s entries are ordered according to rule priority, rule rank, and other criteria.
TIBCO BusinessEvents executes the first rule on the agenda and removes it from the agenda
As a result, one of the following occurs:
  • 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).
Note: Events created during an RTC are not sent to destinations until the entire RTC is complete.

Similarly, objects are not written to cache until the entire RTC is complete.

Note: Content relating to Cache OM and backing store is not relevant to TIBCO BusinessEvents Express edition.

Next conflict resolution cycle

TIBCO BusinessEvents refreshes the rule action agenda
 If a rule action changes the contents of the Rete network, the agenda is refreshed, beginning a new conflict resolution cycle. When the agenda is refreshed, any of the following can occur:
  • 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

An empty agenda ends the RTC
 At some point, no more actions remain to be executed. The conflict resolution has run to completion. The RTC is over. Now begins the post RTC phase. At various points during this phase the following actions happen (depending on how the project has been configured):
  • 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.
  • Profiler: profiler data is updated.