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.
To use the Contiguous Order operator: