Cloud Mode
The CLOUD processing mode is the default processing mode. Users of
rules engine are familiar with this mode because it behaves in exactly the
same way as any pure forward chaining rules engine, including previous
versions of Drools.
When running in CLOUD mode, the engine sees all facts in the working
memory, does not matter if they are regular facts or events, as a whole.
There is no notion of flow of time, although events have a timestamp as
usual. In other words, although the engine knows that a given event was
created, for instance, on January 1st 2009, at 09:35:40.767, it is not
possible for the engine to determine how "old" the event is, because there
is no concept of "now".
In this mode, the engine will apply its usual many-to-many pattern
matching algorithm, using the rules constraints to find the matching tuples,
activate and fire rules as usual.
This mode does not impose any kind of additional requirements on
facts. So for instance:
There is no notion of time. No requirements clock synchronization.
There is no requirement on event ordering. The engine looks at the
events as an unnordered cloud against which the engine tries to match
rules.
On the other hand, since there is no requirements, some benefits are
not available either. For instance, in CLOUD mode, it is not possible to use
sliding windows, because sliding windows are based on the concept of "now"
and there is no concept of "now" in CLOUD mode.
Since there is no ordering requirement on events, it is not possible
for the engine to determine when events can no longer match and as so, there
is no automatic life-cycle management for events. I.e., the application must
explicitly retract events when they are no longer necessary, in the same way
the application does with regular facts.
Cloud mode is the default execution mode for Drools, but in any case,
as any other configuration in Drools, it is possible to change this behavior
either by setting a system property, using configuration property files or
using the API. The corresponding property is:
KnowledgeBaseConfiguration config = KnowledgeBaseFactory.newKnowledgeBaseConfiguration();
config.setOption( EventProcessingOption.CLOUD );
The equivalent property is:
drools.eventProcessingMode = cloud