Advanced Concepts of PySiddhi
The PySiddhi API is a wrapper on Siddhi Java Library, exposing it's core features to Python. It is important to keep following points in mind when using PySiddhi API.
- It is a wrapper. Not a port. - Whenever you use the PySiddhi API, the Siddhi Java Library is loaded in background using Java Virtual Machine.
- The wrapper is focused on functionality provided by siddhi-core which is found in package
io.siddhi.core. The future versions of API may have the ability to load Siddhi Extensions directly from Java Packages and use them in Siddhi Queries. However, the individual Java classes of extensions will not be wrapped.
- Only the classes that are required for API users are wrapped. Classes which are designed to be used by Siddhi Java Library for its internal work will not be wrapped.
- Python doesn't differentiate Integer from Long. But Siddhi do. Python 3 does not differentiate Integer and Long Data Types. All Python Integers fed into Siddhi (via InputHandler) are converted into Java Integers. To feed Java Long to Siddhi (via InputHandler), use DataTypes.LongType. All Long outputs received from Siddhi (via callbacks) will also be converted to DataTypes.LongType.
- Clean up everything when you are done. Remember to call shutdown of SiddhiManager and SiddhiAppRuntime.
Java Siddhi to PySiddhi Mappings
The PySiddhi wrapper is focused on functionality provided by siddhi-core.
The classes in Java package
io.siddhi.core are mapped to
PySiddhi.core using hand written logic. These are not an auto-generated.
The follow table demonstrates major mappings of PySiddhi.
|Java Class||Python Import|