A delay window holds events for a specific time period that is regarded as a delay period before processing them.
WINDOW DELAY(delay <INT|LONG|TIME>)
|Name||Description||Default Value||Possible Data Types||Optional||Dynamic|
|delay||The time period (specified in sec, min, ms) for which the window should delay the events.||INT LONG TIME||No||No|
CREATE WINDOW delayWindow(symbol string, volume int) DELAY(1 hour);
CREATE STREAM PurchaseStream(symbol string, volume int);
CREATE STREAM DeliveryStream(symbol string);
CREATE SINK STREAM OutputStream(symbol string);
INSERT INTO delayWindow
SELECT symbol, volume
INSERT INTO OutputStream
FROM delayWindow JOIN DeliveryStream
ON delayWindow.symbol == DeliveryStream.symbol;
In this example, purchase events that arrive in the
PurchaseStream stream are directed to a delay window. At any given time, this delay window holds purchase events that have arrived within the last hour.
These purchase events in the window are matched by the
symbol attribute, with delivery events that arrive in the
DeliveryStream stream. This monitors whether the delivery of products is done with a minimum delay of one hour after the purchase.