Download Developing Applications for Event Processing with Oracle Stream
Transcript
Queries <processor> <rules> <query id=rule2 <![CDATA[RSTREAM (SELECT * FROM StockTradeIStreamChannel [ROWS 2 > </query> </rules> </processor> 6.3.2.3 NOW and Last Event Windows A NOW window to contain the event that happened at the last tick of the system. With the NOW operator, the last input event can be deleted in the next time tick (the new NOW) so you might not have captured what you want. If you truly the last input event, use a last event window. The following example shows how to construct a NOW window. SELECT * FROM StockTradeIStream[NOW] The following configuration file entry shows the NOW operator. <processor> <rules> <query id=rule2 <![CDATA[ISTREAM (SELECT * FROM StockTradeIStreamChannel [NOW> </query> </rules> </processor> A last event window captures the last event received. The following example shows how to construct a last event window. SELECT * FROM StockTradeIStream[ROWS 1] The following configuration file entry shows a last event window. <processor> <rules> <query id=rule2 <![CDATA[ISTREAM (SELECT * FROM StockTradeIStreamChannel [ROWS 1 > </query> </rules> </processor> 6.3.3 Processor Output Control (Slides) Instead of outputting query results as they happen, you can use the SLIDE operator in a subclause to batch the output events. You can batch the events based on the number of events when you use the ROW operator or an amount of time (time window) when you use the RANGE operator. Note: When a slide value is not specified, the query assumes the default value of 1 row for tuple-based windows, and 1 time tick for time-based windows. Batch by Number of Events The following example outputs every 2 events (2, 4, 6, 8, ...). SELECT * FROM StockTradeIStreamChannel[ROWS 3 SLIDE 2] Oracle CQL Processors 6-7