How do you delay each event by a fixed amount of time before publishing? Here's a simple example using the AGING feature of CCL and a filter. Until an event has "aged' by the desired amount it doesn't pass thru the filter.
/* This example simply buffers incoming events and then publishes them after a delay.
* The amount of delay is the value in the AGES clause. Note that the value in the KEEP clause
* needs to be greater than the value in the AGES clause. The output stream will suppress the
* deletes generated by the retention policy (i.e. the KEEP clause)
*
*/
CREATE INPUT STREAM EventsIn
SCHEMA (Column1 integer , Column2 integer );
CREATE OUTPUT WINDOW Delay
SCHEMA (ID long, Age integer, Column1 integer , Column2 integer )
PRIMARY KEY ( ID )
KEEP 10 SECONDS
AGES EVERY 5 SECONDS SET Age
AS SELECT
nextval() as ID,
0 as Age,
EventsIn.Column1 as Column1,
EventsIn.Column2 as Column2
FROM EventsIn;
CREATE OUTPUT STREAM EventsOut
AS SELECT
Delay.Column1 Column1 ,
Delay.Column2 Column2
FROM Delay
WHERE Delay.Age = 1;
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
29 | |
21 | |
10 | |
7 | |
7 | |
6 | |
6 | |
5 | |
5 | |
5 |