This section provides information on using Siddhi Query Language in the Siddhi Analytics agent.
For further information on Siddhi Query Language, see http://wso2.github.io/siddhi/documentation/siddhi-4.0/.
Siddhi Extensions
The extensions that are included in are the following:
- math
- string
- unique
Working with UDRs
This section provides information on how to work with UDRs when using the Siddhi Analytics agent, providing examples in Siddhi Query Language.
Input UDRs
UDRs routed to the Siddhi Analytics agent are inserted into all compatible input streams and are either
- Kept if the first attribute of the input stream is
input object
, or - Discarded
See the examples below.
Output UDRs
UDRs routed from the Siddhi Analytics agent are either
- Newly created, or
- Reused from the input stream if the first attribute selected is
input
.
See the examples below.
Updating UDRs
UDRs are updated if they are inserted into an output stream that is routed, otherwise they are passed along unchanged.
Examples
The following examples show how to work with UDRs in Siddhi Query Language.
Example
The input UDR is kept and is output unchanged when its price is greater than 10.5.
define stream StockInputStream(input object, symbol string, price float); from StockInputStream[price > 10.5] select input insert into StockOutputStream;
Example
The input UDR is kept and its price is increased by 1 when its price is greater than 10.5.
define stream StockInputStream(input object, symbol string, price float); from StockInputStream[price > 10.5] select input, price + 1 as price insert into StockOutputStream;
Example
The input UDR is discarded and a newly created UDR is output when the price is greater than 10.5.
define stream StockInputStream(symbol string, price float); from StockInputStream[price > 10.5] select symbol, price insert into StockOutputStream;