Pattern Matching

Use the MATCHING clause in your CCL query to take input from one or more elements (streams, windows, or delta streams) and produce records when a prescribed pattern is found within the input data.

Patterns can check whether or not events occur during a specific time interval, and then send records to downstream streams.

Attention: The pattern rule engine matches patterns regardless of the opcode of the input records, unless the opcode is included as part of the pattern matching criteria.
This example creates an output stream, ThreeConsecTrades, which monitors the QTrades streams and sends a new event when it detects three consecutive trades on the same symbol within five seconds. The output of this stream is the symbol of the traded stock, and its latest three prices.
CREATE OUTPUT STREAM ThreeConsecTrades
AS 
SELECT 
		T1.Symbol, 
		T1.Price Price1,
		T2.Price Price2,
		T3.Price Price3
FROM QTrades T1, QTrades T2, QTrades T3
MATCHING[5 SECONDS: T1, T2, T3]
ON T1.Symbol = T2.Symbol = T3.Symbol
;
Related reference
Filtering
Unions
Joins
Aggregation
MATCHING Clause