Note: This feature is not supported in Distributed Cache Mode Deployment and Persistence Mode Deployment
from <stream-name>
select ( {<attribute-name>}| ‘*’|) output { (<output-type>)? every ( <time-expr> | <event-interval> events ) } | { snaphost every <time-expr> }
insert into <stream-name>
Output rate limiting will only output events periodically based on the conditions specified.
Output First with Temporal Condition
Outputs the first element only based on the condition.
Following example outputs the first IP received from loginEvents stream in a second and outputs it at the end of 1 second for all event types (both current events and expired events)
from loginEvents
select ip output first every 1 sec
insert into uniqueIps for all-events;
Output Last with Event Condition
Outputs the last element only based on the condition.
Following example outputs the last IP received from loginEvents stream within the last 5 events and outputs it at the arrival of the 5th event for all event types. This would have the behavior of emitting an event per every 5 events.
from loginEvents
select ip output last every 5 events
insert into uniqueIps for all-events;
Output All with Temporal Condition
Outputs all the elements only based on the condition.
Following example outputs all the IPs received from loginEvents stream in the last 5 minutes outputs it at the end of 5 minutes as a batch for all event types.
from LoginEvents
select ip output all every 5 min
insert into uniqueIps for all-events;
Snapshot Output Rate Limiting
Output a snapshot of the current events (which can be active events or expired events) that matches a specified condition.
The following query will output a snapshot every one second giving the contents of the window at the time of taking the snapshot. Make sure to always use a window with the snapshot output rate limiting!
from LoginEvents#window.time(5 sec)
select ip
output snapshot every 1 sec
insert into uniqueIps for all-events