Try OpenEdge Now
skip to main content
BPM Events User's Guide
The rule language : Adding and removing rules dynamically : Dynamically enabling and disabling rules
 

Dynamically enabling and disabling rules

It is sometimes necessary to modify the current rule base at a finer level of granularity than the rule module. Remember that a module is divided into rule groups, which are generally units of rules achieving a common function (that is, some monitoring). You may not add or remove dynamically rules or rule groups to a module that is loaded (unless you modify the module itself, and "replace" it, as previously mentioned), but it is possible to "turn off" some of its rules or some of its rule groups. For example, turning off the rule group inside a module that implements a monitoring option that is no longer necessary, may speed up the processing of a future events. Or, a module may contain several monitoring options, only a subset of which are necessary at any time, but because they all work with the same objects (infopads), we still want them in the same module.
The turning off of a rule or a rule group is called "disabling" the rules. Disabling a rule does not actually remove the rule from the engine, like unload does. It only makes the rule(s) invisible to oncoming events. It is then possible to "enable" the rule again. When a module is loaded, all its rules are initially enabled.
The enabling/disabling of rules and rule groups is accomplished through BPM Events Admin, or from other rules through the action statements "enableRule," and "disableRule," described in Dynamically enabling and disabling rules later in this chapter.