With WSO2 SP's streaming SQL capabilities and its inbuilt editor that has event simulation and debugging support, it can help you to create real-time applications much faster than before. The WSO2 SP version 4.0.0 is a new product focusing on solving stream processing and complex event processing use cases.
WSO2 SP uses a single Siddhi Streaming SQL file for script data collection, processing, and notification logic. The batch analytics aspect is handled via Siddhi aggregations.
To use Siddhi, you need to write the processing logic as a Siddhi pplication in application in the Siddhi Streaming SQL language.Once a Siddhi application is created and started, it does the following:
@attributes is an optional annotation used with the
@map annotation to define custom mapping that replaces
<mapping customMapping> in the CEP/DAS server. When the
@attributes annotation is not provided, each mapper assumes that the incoming events adhere to its own default data format. By adding the
@attributes annotation, you can configure mappers to extract data from the incoming message selectively, and assign them to attributes.
There are two ways you can configure map attributes.
- Defining attributes as keys and mapping content as values in the following format.
@attributes( attributeN='mapping_N', attribute1='mapping_1')
- Defining the mapping content of all attributes in the same order as how the attributes are defined in stream definition.
@attributes( 'mapping_1', 'mapping_N')
This query receives events via the
HTTP source in the
JSON data format, and directs them to the
InputStream stream for processing. Here the
HTTP source is configured to receive events on all network interfaces at the
8080 port and on the foo context. The source is also secured via basic authentication.
|Configuration in WSO2 DAS|
|Configuration in Siddhi file|
@PrimaryKey('symbol') define table StockTable (symbol string, price float, volume long);
Indexes allow tables to be searched/modified much faster.
Indexes are configured by including the
@Index( 'key1', 'key2' ) annotation to the table definition. Each event table configuration can have 0-1
@Index annotations. Support for the
@Index annotation and the number of attributes supported differ based on the table implementations. When more then one attribute is used for index, each one of them is used to index the table for fast access of data. Indexes can be configured together with primary keys.
This query creates an indexed event table named
RoomTypeTable with the
roomNo attribute as the index key.
@Index('roomNo') define table RoomTypeTable (roomNo int, type string);
Execution Plan -> Queries