The Siddhi CEP engine processes events in real time. A sequence of events of the same event type is defined as a stream, and processed by Siddhi via the SQL-like Siddhi Query Language (SiddhiQL). Siddhi works as an upside down database by storing all the queries in memory, matching incoming events against the stored queries at runtime, and producing matched events as streams.
In-order to process events, the execution logic must be written as a script using SiddhiQL, and these scripts must be deployed in the server as execution plans. An execution plan acts as an isolated execution environment, and a separate instance of Siddhi execution runtime is created for each execution plan. An execution plan can import one or more streams from the server for processing and push zero or more output streams back to the server. In order to import and export streams, the script contains import and export annotations that bind the streams on the server with the streams defined in the execution plan.