Striim 3.9.4 / 3.9.5 documentation


CREATE TYPE <name> ( <field name> <data type> [KEY], ... );

KEY defines the field that will be used to relate events in WActions when the type is specified as the CONTEXT OF in the CREATE WACTIONSTORE statement.

Example from the PosApp sample application:

CREATE TYPE ProductTrackingType (
  sku String KEY, 
  salesAmount double, 
  Count Integer, 
  startTime DateTime 

Unlike other components, types do not need to be deployed. They are available for use in running applications as soon as they are created.

You cannot specify a composite key directly. Instead, create a CQ that concatenates two or more fields into a new field, then make that field the key. For example, if inputStream has this type:

CREATE TYPE inputType(
  SubKey1 String,
  SubKey2 String,
  Name String,
  UniqueID String KEY

The following will create a composite key on the first two fields:

CREATE TYPE outputType(
  SubKey1 String,
  SubKey2 String,
  Name String,
  CompKey String KEY
CREATE STREAM outputStream OF outputType;
CREATE CQ makeCompositeKey
  INSERT INTO outputStream
  SELECT SubKey1,
    SubKey1 + SubKey2 KEY
  FROM inputStream;