Versions Compared

Key

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

Events are the lifeline of WSO2 CEP/DAS. They not only process data as events, but also interact with external systems using events. Event is a unit of data, and an event stream is a sequence of events of a particular type. The type of events can be defined as an event stream definition. The following sections explain how to work with events in WSO2 CEP.

Table of Contents
maxLevel3
minLevel3

...

You can manage event streams through event stream definitions. 

...

Definitions of the event streams are stored in the filesystem as deployable artifacts in the  <PRODUCT _HOME>/repository/deployment/server/eventstreams/ directory as .json files. These are hot deployable files and can be added/removed when the server is up and running. A sample event stream definition is as follows.

Code Block
languagejs
{
  "streamId": "org.wso2.test:1.0.0",
  "name": "org.wso2.test",
  "version": "1.0.0",
  "nickName": "TestStream",
  "description": "Test Stream",
  "metaData": [
    {
      "name": "ip",
      "type": "STRING"
    }
  ],
  "correlationData": [
    {
      "name": "id",
      "type": "LONG"
    }
  ],
  "payloadData": [
    {
      "name": "testMessage",
      "type": "STRING"
    }
  ]
}

The properties of the above event stream definition are described below.

...

Stream Attributes contains the data of the event. These are divided into three logical separations to give more usability and maintenance to the user. It is not mandatory to have attributes in all three sections, but there should be at least one section with at least one attribute defined. Also attribute names should be unique within each section.

  • Meta Data: Contains the meta information of the events. (Referred to as  meta_<attribute name>.)
  • Correlation Data: Contains the correlation information of the events.  (Referred to as  correlation_<attribute name>.).
  • Payload Data: Contains the actual data that the event intends to have.  (Referred to as <attribute name>.)

It is recommended to have logistic separation but the internal system does not differentiate or give privilege based on above separations. Also please note if you edit and add another attribute to existing stream definition, other artifacts which are associated with the stream will be inactive. So that it is recommended to create a new stream definition with a version including the additional attribute.

For example consider following attributes which exist in a single event.

event_timestamp, request_IP_address, correlation_Id, price, symbol with there corresponding data types.

We can logically separate the above attributes as following.

...

Events are the lifeline of WSO2 CEP/DAS. They not only process data as events, but also interact with external systems using events. Event is a unit of data, and an event stream is a sequence of events of a particular type. The type of events can be defined as an event stream definition. The following sections explain how to work with events in WSO2 CEP.

Table of Contents
maxLevel3
minLevel3

Event streams
Anchor
Event streams
Event streams

You can manage event streams through event stream definitions. 

Anchor
Event stream definitions
Event stream definitions
Event stream definition

Definitions of the event streams are stored in the filesystem as deployable artifacts in the  <PRODUCT _HOME>/repository/deployment/server/eventstreams/ directory as .json files. These are hot deployable files and can be added/removed when the server is up and running. A sample event stream definition is as follows.

Code Block
languagejs
{
  "streamId": "org.wso2.test:1.0.0",
  "name": "org.wso2.test",
  "version": "1.0.0",
  "nickName": "TestStream",
  "description": "Test Stream",
  "metaData": [
    {
      "name": "ip",
      "type": "STRING"
    }
  ],
  "correlationData": [
    {
      "name": "id",
      "type": "LONG"
    }
  ],
  "payloadData": [
    {
      "name": "testMessage",
      "type": "STRING"
    }
  ]
}

The properties of the above event stream definition are described below.

PropertyDescription
Event Stream NameName of the event stream.
Event Stream VersionVersion of the event stream. (Default value is 1.0.0.)
Event Stream DescriptionDescription of the events stream. (This is optional.)
Event Stream Nick-NameNick-names of an event streams separated by commas. (This is optional.)
Stream Attributes

Stream attributes contains the data of the event. Data is divided into the following 3 logical categories for maintenance and usability. It is not required to to have attributes for all 3 categories, but there should be at least one category with at least one attribute defined. The attribute names should be unique within each category.

  • Meta Data: This refers to meta information of the events (e.g., timestamp, host, IP, etc.). They are received with the meta tag (i.e., in the meta_<attribute name> format).
  • Correlation Data: This refers to information that is used to correlate multiple events (e.g., correlation_id,temporal_id etc.). They are received with the correlation tag (i.e., in the correlation_<attribute name> format).
  • Payload Data: Contains the actual data that the event intends to have. (Referred to as <attribute name>.)

e.g., The following attributes exist in a single event.

  • event_timestamp
  • request_IP_address
  • correlation_Id
  • price
  • symbol

These attributes can be logically categorized as follows.

CategoryAttributesNotes
Meta Data
  • event_timestamp
  • request_IP_address
These attributes provide information about the events themselves.
Correlation Data
  • correlation_Id
This attribute correlates the event with other events from other streams, and it is useful when performing join operations on a stream.
Payload Data
  • price
  • symbol
These are information provided via the event.
Info
  • Note that the internal system does not differentiate the attributes based on this categorization. However, it is recommended to categorize the attributes for the purpose of organizing them in a logical manner within the stream definition.
  • If you edit an attribute in an event stream or add a new attribute to it, other artifacts that are associated with the stream will be inactive. Therefore, it is recommended to redefine the stream with a new version including the additional/changed attribute.

Adding an event stream 
Anchor
Add
Add

...