Child pages
  • Introduction to Siddhi Query Language

This documentation is for WSO2 CEP 3.0.0. View the home page of the latest release.

                                                                                                                                                                                                                                                                                                                                                                                                       
||
Skip to end of metadata
Go to start of metadata

Siddhi Query Language (SiddhiQL) is designed to process streams and identify complex event occurrences. Before we look into details of the Siddhi Query Language, let's take a look at a few definitions of terms.

TermDefinition
Event StreamLogical series of events ordered in time
Event Stream DefinitionDefines event streams. An event stream has a unique name and a set of typed attributes with uniquely identifiable names that define its schema.
EventAn event is associated with one event stream only, and all events of that stream have an identical set of typed attributes (or the same schema).
AttributeHas a unique name within the event stream, and they have a type as INT, LONG, BOOLEAN, FLOAT, DOUBLE or STRING
QueryA logical construct that derives new streams by combining existing streams. Query contains some input streams, handlers to modify these input streams, and an output stream to which it publishes its output events.
PartitionA logical container that processes a subset of the query based on a pre-defined rule of separation.
Partition DefinitionDefines a partition. A partition is based on either a variable or a range.

Siddhi queries describe how to combine existing event streams to create new event streams. When deployed in the Siddhi runtime, Siddhi queries process incoming event streams, and as specified by the queries, they generate new output event streams if they don’t exist. 

For example, let us consider an event stream called StockExchangeStream that has three parameters: ‘symbol’ of type String, ‘price’ of type float, and ‘volume’ of type int.

from StockExchangeStream[volume <10] 
select symbol, volume
insert into StockQuoteStream partition by StockSymbol

The above query will create a new stream called ‘StockQuoteStream’, that has two attributes as ‘symbol’ of type STRING and ‘volume’ of type INT having events from StockExchangeStream that have the volume attribute less than 10. It will also create a separate partition for processing of each stock symbol.

  • No labels