Defining a CEP Engine
Creating a CEP Engine
Syntax
createCEPEngine(name, monitors, dummyTable, eventSchema,
[deserializeParallelism=1], [timeColumn], [eventQueueDepth=1024],
[outputTable], [dispatchKey], [dispatchBucket],
[useSystemTime=true])
Arguments
name is a string scalar indicating the name of the CEP engine. It consists of letters, digits, and underscores(_) and must start with a letter.
monitors is metacode or a tuple of metacode containing one or more
constructors of Monitor
class. If multiple constructors are
specified, the monitor objects will be constructed in order. For the
instructions on how to define a monitor, refer to Defining Monitors.
dummyTable is a table object with the same schema as the subscribed stream table.
eventSchema is a scalar or vector of class definition of event types, indicating the events (subscribed from APIs or plugins) to be processed. For the instructions on how to define an event, refer to Defining Events.
deserializeParallelism (optional) is an integer that specifies the number of workers to deserialize the subscribed stream table. The default value is 1.
timeColumn (optional) is a string indicating the time column of dummyTable. If specified, it stores the timestamps of events.
eventQueueDepth (optional) is an integer that specifies the queue depth for event input and output queue. The default value is 1024.
outputTable (optional) is a table object returned by
streamEventSerializer
, indicating the output table for
further processing. It must be specified when the emitEvent
is called.
dispatchKey (optional) is a string scalar indicating the event fields.
-
If specified,the engine creates sub-engines based on the number of unique values of the event field.
-
If not specified, the engine only creates a single sub-engine with the same name as CEP engine (name).
dispatchBucket (optional) is an integer indicating the number of hash buckets. It is used to group the specified event field (dispatchKey) using hash algorithm. To specify this parameter, dispatchKey must be specified. If specified, the engine creates the sub-engines based on bucket numbers specified by dispatchBucket.
useSystemTime (optional) is a Boolean value indicating whether the calculations are performed based on the system time (in millisecond) when the event is ingested into the engine. The default value is true. If set to false, the calculations are performed based on the timeColumn.
Stopping a Sub-Engine
To stop event processing operations within a specific sub-engine, you can call
stopSubEngine()
in any of its monitor instances.
Before the sub-engine is stopped, the following actions occur:
-
If there are spawned monitor instances, the engine will invoke the
onDestroy()
function defined in those spawned monitor instances first. -
The engine executes all
onunload()
functions (if defined) declared in the monitor instance.
Syntax
stopSubEngine()
Arguments
None