CREATE SORTER
CREATE SORTER <name> OVER <input stream 1 name> ON <timestamp field name> OUTPUT TO <output stream 1 name>, <input stream 2 name> ON <timestamp field name> OUTPUT TO <output stream 2 name> [, input stream 3 name> ON <timestamp field name> OUTPUT TO <output stream 3 name>... ] WITHIN <integer> { SECOND | MINUTE | HOUR | DAY } OUTPUT ERRORS TO <error output stream name>;
This ensures that events from multiple streams are processed in sync with each other based on timestamps in the streams. For example:
CREATE SORTER MySorter OVER Stream1 ON logTime OUTPUT TO Stream1Sorted, Stream2 ON logTime OUTPUT TO Stream2Sorted WITHIN 2 second OUTPUT ERRORS TO fooErrorStream;
If the events in Stream1
and Stream2
fall out of sync by more than two seconds, the stream with the more recent timestamps is buffered until the events from the other stream with matching timestamps arrive.