-
Notifications
You must be signed in to change notification settings - Fork 0
Home
Welcome to PySiddhi wiki.
Siddhi is a Query Language and a Library developed by WSO2 Inc. for Real-time Complex Events Processing. Siddhi CEP Library is currently used in WSO2 Data Analytics Server, an Enterprise Grade Open Source Data Analytics Solution.
The Siddhi CEP Library is originally written in Java 8.0. PySiddhi is a Python wrapper on Siddhi CEP Java Library.
The following versions of Siddhi CEP is covered by this Python wrapper.
- Siddhi CEP 3.1.0 (Released Version) is wrapped by PySiddhi3.
- Siddhi CEP 4.0.0-M53 (In Development Version) is wrapped by PySiddhi4.
PySiddhi4 includes a REST Client on WSO2 Data Analytics Server 4.0.0-M6.
Note: PySiddhi API is initiated by a project for Google Summer of Code 2017 Program.
- Introduction (this page)
- Installation Guide
- Full Quick Demo
- Using Siddhi from Python
- Using Siddhi Extensions
- WSO2 Data Analytics Server 4.0 REST Client (only applicable for PySiddhi4)
- Debugging Siddhi Queries (only applicable for PySiddhi4)
The following is a demo code on PySiddhi3. For a demo on PySiddhi4, refer this link.
Step 1 - Define your query using Siddhi.
define stream cseEventStream (symbol string, price float, volume long);
@info(name = 'query1') from cseEventStream[volume < 150] select symbol,price insert into outputStream;
For more details on Siddhi Query Language, refer Siddhi Query Language Guide in WSO2 Docs.
Step 2 - Feed input events using Input Handler.
inputHandler.send(["IBM",700.0,LongType(100)])
inputHandler.send(["WSO2", 60.5, LongType(200)])
...
Step 3 - Receive callbacks on output events.
class QueryCallbackImpl(QueryCallback):
def receive(self, timestamp, inEvent, outEvent):
PrintEvent(timestamp, inEvents, outEvents)
executionPlanRuntime.addCallback("query1",ConcreteQueryCallback())
Receive Outputs
INFO EventPrinter - Events{ @timestamp = 1497708406678, inEvents = [Event{timestamp=1497708406678, id=-1, data=[IBM, 700.0], isExpired=false}], RemoveEvents = null }
...
Refer Full Quick Demo for complete code on above example.
PySiddhi can be installed as a Python Library from Source Code. No binary releases are available as of now.
Refer Installation Guide for installation prerequisites and other details. Using the following PIP commands, it is possible to directly install PySiddhi API from online GitHub Repository.
pip install git+https://github.com/wso2/PySiddhi.git
pip install git+https://github.com/wso2/PySiddhi.git@3.x