Designing Intelligent Event Processor (IEP) Projects

Sequence Operators

Sequence operators enable you to order events based on attributes that have sequential order.

The following table lists the input and output for each operator.

Operator 

Input 

Output 

Contiguous Order 

Stream 

Stream 

Gap Window 

Stream 

Relation 

Contiguous Order

The Contiguous Order operator defines a stream that consists of events selected by one or more attributes and then placed in sequence sorted by another attribute.

Assume that you have the following scenario:

You could add a Stream Input operator with the following attributes:

You could then connect the Stream Input operator to a Contiguous Order operator.

In the property editor of the Contiguous Order operator, set the partition key to the deviceID attribute. This setting divides the input stream into multiple substreams, one per device.

In the property editor of the Contiguous Order operator, set the sort value to the msgID attribute and the start value to 1. For each substream, the Contiguous Order operator sorts the messages by their unique ID.

For example, let's say that the messages from one device arrive in the following order: 3, 2, 5, 1, 7, 4, 4, 6.

When message 1 is received, the Contiguous Order operator will output messages 1, 2, and 3. When message 4 is received, the Contiguous Order operator will output messages 4 and 5. When message 6 is received, the Contiguous Order operator will output messages 6 and 7.

The Contiguous Order operator ignores duplicate events. Therefore, the output stream in the hardware device scenario contains only one instance of message 4.

Note that in the output stream, the output from the multiple substreams is interspersed.

ProcedureTo Create a Contiguous Order Operator:

  1. Drag a Contiguous Order operator from the Palette to the Design view.

  2. Connect the input of the new Contiguous Order component to an operator that has stream output.

  3. Double-click the Contiguous Order operator.

    The property editor opens. Notice that the component has inherited the schema of its input stream.

  4. In the Attributes area, set the Partition Key column to the attribute or attributes that you want to use to divide the input stream into substreams.

  5. In the Sort By drop-down list, select the attribute that you want to sort by.

    The attribute must have values that can be sorted sequentially.

  6. In the Start field, type the attribute value that you want to start with.

  7. (Optional) Click the Documentation tab and supply notes on this component.

  8. Click OK.

Gap Window

The Gap Window operator defines a relation that consists of events that are missing from the input stream, based on an attribute that has a sequential order.

Assume that you have the following scenario:

You could add a Stream Input operator with the following attributes:

You could then connect the Stream Input operator to a Gap Window operator.

In the property editor of the Gap Window operator, set the partition key to the deviceID attribute. This setting divides the input stream into multiple substreams, one per device.

In the property editor of the Gap Window operator, set the sort value to the msgID attribute and the start value to 1. For each substream, the Gap Window operator creates an output relation that indicates which message is missing at any point in time.

For example, let's say that the messages from one device arrive in the following order: 3, 2, 5, 1, 7, 4, 4, 6.

When message 3 is received, the Gap Window operator will output message 1. When message 1 is received, the Gap Window operator will output message 4. When message 4 is received, the Gap Window operator will output message 6. When message 6 is received, the Gap Window operator will output message 8.

Note that in the output relation, the output from the multiple relations is interspersed.

ProcedureTo Create a Gap Window Operator:

  1. Drag a Gap Window operator from the Palette to the Design view.

  2. Connect the input of the new Gap Window component to an operator that has stream output.

  3. Double-click the Gap Window operator.

    The property editor opens. Notice that the component has inherited the schema of its input stream.

  4. In the Attributes area, set the partition key to the attribute or attributes that you want to use to divide the input stream into substreams.

  5. In the Sort By drop-down list, select the attribute that you want to sort by.

    The attribute must have values that can be sorted sequentially.

  6. In the Start field, type the attribute value that you want to start with.

  7. (Optional) Click the Documentation tab and supply notes on this component.

  8. Click OK.