Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Context Store Management

The feature "context" can be added for management context information.

This means, it is possible to store or cache events without using the blocking window operator. First of all, this is useful for slowly changing events (like states in a smart home or in a factory), because in a window-operator you have to wait until the state changes a second time before the first change gets available. Therefore, the context store is a special concept to avoid such a blocking behavior. For each context event (each state), there is a context store needed. This means, for example, that there is one context store for each door in a smart home. After creating a context store, the system can use the store-operator to write into the store and can use the enrich-operator to read from the store. Furthermore, there is a RCP-view to show the actual content of the context sotre. All these parts works as follows.

Context Store - create and drop

Creating and removing of context stores is done by a CQL-Statement. To create a new store, you may use the following statement (which is similar to the create stream statement):

...

It is possible to omit "IF EXISTS", because it only prevents for throwing an exception if the context store that has to be dropped does not exists.

 

STORE - writing into a store

The store operator is used for storing data. If you want to store the contents of "inputoperator" into the context store named "door4", the store-operator is used as follows:

...

so, you only have to define the name of the store. Notice, that the output-schema of inputoperator has to be union-compatible with the schema of the definied store. Union-compatible means: only the datatypes have to be equal, but not the names of the attributes.

ENRICH - reading from a store

The enrich operator is used for reading data. The enrich has technically two inputs: one for the data that should be enriched and one for the data from the context store. So, if a new event from the normal input gets into the enrich operator, it queries all temporally correlating context information from the context storage and merges it to the incoming event. Since it may happen that the there are two or more context states in the context storage that have to be merged, the enrich could produce also two or more enriched events.

...

if the outer-option is set to "true", the enrich will enrich events with "null"-values instead of discarding them (thus, its like an outer join).

View - show the context of stores

if you use the rcp-view, you can use the "Context Store" view. This can be found under the menu windows -> show view -> other... -> odysseus.

...