Reorder Extension
Reorder extension is implemented using the K-Slack
 algorithm. The K-Slack
 Siddhi extension is used for reordering events from an unordered event stream. The following is an example of a query with the reorder
 extension.
Â
@info(name = 'query1') from inputStream#reorder:kslack(eventTimestamp) select eventTimestamp, price, volume insert into outputStream;
There are several important variations of the K-slack API of which the details are described below
K-Slack function
Syntax |
|
---|---|
Extension Type | StreamProcessor |
Description | This is the most basic version. The events are sorted by theÂ
timestamp
 parameter. |
Syntax |
|
---|---|
Extension Type | StreamProcessor |
Description | The second argument shown in the above syntax corresponds to a fixed time-out value set at the beginning of the process. Once the time-out value expires, the extension drains all the events that are buffered within the reorder extension to outside. The time out has been implemented internally using a timer. The events buffered within the extension are released each time the timer ticks. |
Syntax | <bool>Â reorder:kslack(<long>Â timestamp, <long> timeOut, <long> maxValue ) |
---|---|
Extension Type | StreamProcessor |
Description | The third argument in the above syntax is the maximum value for K. This is the amount to which the K value of the K-Slack algorithm will be increased. |
Example |
|
Syntax |
|
---|---|
Extension Type | StreamProcessor |
Description | The fourth argument in the above syntax is a flag that indicates whether the out-of order events that appear after the expiration of the K-slack window should be discarded or not. |
Example | kslack(timestamp, -1l, true)
|