diff --git a/README.md b/README.md index 1fe5aca0a8..0edcb965e6 100644 --- a/README.md +++ b/README.md @@ -40,7 +40,7 @@ For more information on using Siddhi refer 5.1.1. +Latest API Docs is 5.1.2. ## Support and Contribution diff --git a/docs/api/5.1.2.md b/docs/api/5.1.2.md new file mode 100644 index 0000000000..be2cdb0099 --- /dev/null +++ b/docs/api/5.1.2.md @@ -0,0 +1,2554 @@ +# API Docs - v5.1.2 + +## Core + +### and *(Aggregate Function)* +

+

Returns the results of AND operation for all the events.

+

+Syntax + +``` + and( arg) +``` + +QUERY PARAMETERS + + + + + + + + + + + + + + + + + +
NameDescriptionDefault ValuePossible Data TypesOptionalDynamic
arg

The value that needs to be AND operation.

BOOLNoYes
+ +Examples +EXAMPLE 1 +``` +from cscStream#window.lengthBatch(10) +select and(isFraud) as isFraudTransaction +insert into alertStream; +``` +

+

This will returns the result for AND operation of isFraud values as a boolean value for event chunk expiry by window length batch.

+

+### avg *(Aggregate Function)* +

+

Calculates the average for all the events.

+

+Syntax + +``` + avg( arg) +``` + +QUERY PARAMETERS + + + + + + + + + + + + + + + + + +
NameDescriptionDefault ValuePossible Data TypesOptionalDynamic
arg

The value that need to be averaged.

INT
LONG
DOUBLE
FLOAT
NoYes
+ +Examples +EXAMPLE 1 +``` +from fooStream#window.timeBatch + select avg(temp) as avgTemp + insert into barStream; +``` +

+

avg(temp) returns the average temp value for all the events based on their arrival and expiry.

+

+### count *(Aggregate Function)* +

+

Returns the count of all the events.

+

+Syntax + +``` + count() + count( arg) +``` + +QUERY PARAMETERS + + + + + + + + + + + + + + + + + +
NameDescriptionDefault ValuePossible Data TypesOptionalDynamic
arg

This function accepts one parameter. It can belong to any one of the available types.

INT
LONG
DOUBLE
FLOAT
STRING
BOOL
OBJECT
YesYes
+ +Examples +EXAMPLE 1 +``` +from fooStream#window.timeBatch(10 sec) +select count() as count +insert into barStream; +``` +

+

This will return the count of all the events for time batch in 10 seconds.

+

+### distinctCount *(Aggregate Function)* +

+

This returns the count of distinct occurrences for a given arg.

+

+Syntax + +``` + distinctCount( arg) +``` + +QUERY PARAMETERS + + + + + + + + + + + + + + + + + +
NameDescriptionDefault ValuePossible Data TypesOptionalDynamic
arg

The object for which the number of distinct occurences needs to be counted.

INT
LONG
DOUBLE
FLOAT
STRING
NoYes
+ +Examples +EXAMPLE 1 +``` +from fooStream +select distinctcount(pageID) as count +insert into barStream; +``` +

+

distinctcount(pageID) for the following output returns '3' when the available values are as follows.
 "WEB_PAGE_1"
 "WEB_PAGE_1"
 "WEB_PAGE_2"
 "WEB_PAGE_3"
 "WEB_PAGE_1"
 "WEB_PAGE_2"
 The three distinct occurences identified are 'WEB_PAGE_1', 'WEB_PAGE_2', and 'WEB_PAGE_3'.

+

+### max *(Aggregate Function)* +

+

Returns the maximum value for all the events.

+

+Syntax + +``` + max( arg) +``` + +QUERY PARAMETERS + + + + + + + + + + + + + + + + + +
NameDescriptionDefault ValuePossible Data TypesOptionalDynamic
arg

The value that needs to be compared to find the maximum value.

INT
LONG
DOUBLE
FLOAT
NoYes
+ +Examples +EXAMPLE 1 +``` +from fooStream#window.timeBatch(10 sec) +select max(temp) as maxTemp +insert into barStream; +``` +

+

max(temp) returns the maximum temp value recorded for all the events based on their arrival and expiry.

+

+### maxForever *(Aggregate Function)* +

+

This is the attribute aggregator to store the maximum value for a given attribute throughout the lifetime of the query regardless of any windows in-front.

+

+Syntax + +``` + maxForever( arg) +``` + +QUERY PARAMETERS + + + + + + + + + + + + + + + + + +
NameDescriptionDefault ValuePossible Data TypesOptionalDynamic
arg

The value that needs to be compared to find the maximum value.

INT
LONG
DOUBLE
FLOAT
NoYes
+ +Examples +EXAMPLE 1 +``` +from inputStream +select maxForever(temp) as max +insert into outputStream; +``` +

+

maxForever(temp) returns the maximum temp value recorded for all the events throughout the lifetime of the query.

+

+### min *(Aggregate Function)* +

+

Returns the minimum value for all the events.

+

+Syntax + +``` + min( arg) +``` + +QUERY PARAMETERS + + + + + + + + + + + + + + + + + +
NameDescriptionDefault ValuePossible Data TypesOptionalDynamic
arg

The value that needs to be compared to find the minimum value.

INT
LONG
DOUBLE
FLOAT
NoYes
+ +Examples +EXAMPLE 1 +``` +from inputStream +select min(temp) as minTemp +insert into outputStream; +``` +

+

min(temp) returns the minimum temp value recorded for all the events based on their arrival and expiry.

+

+### minForever *(Aggregate Function)* +

+

This is the attribute aggregator to store the minimum value for a given attribute throughout the lifetime of the query regardless of any windows in-front.

+

+Syntax + +``` + minForever( arg) +``` + +QUERY PARAMETERS + + + + + + + + + + + + + + + + + +
NameDescriptionDefault ValuePossible Data TypesOptionalDynamic
arg

The value that needs to be compared to find the minimum value.

INT
LONG
DOUBLE
FLOAT
NoYes
+ +Examples +EXAMPLE 1 +``` +from inputStream +select minForever(temp) as max +insert into outputStream; +``` +

+

minForever(temp) returns the minimum temp value recorded for all the events throughoutthe lifetime of the query.

+

+### or *(Aggregate Function)* +

+

Returns the results of OR operation for all the events.

+

+Syntax + +``` + or( arg) +``` + +QUERY PARAMETERS + + + + + + + + + + + + + + + + + +
NameDescriptionDefault ValuePossible Data TypesOptionalDynamic
arg

The value that needs to be OR operation.

BOOLNoYes
+ +Examples +EXAMPLE 1 +``` +from cscStream#window.lengthBatch(10) +select or(isFraud) as isFraudTransaction +insert into alertStream; +``` +

+

This will returns the result for OR operation of isFraud values as a boolean value for event chunk expiry by window length batch.

+

+### stdDev *(Aggregate Function)* +

+

Returns the calculated standard deviation for all the events.

+

+Syntax + +``` + stdDev( arg) +``` + +QUERY PARAMETERS + + + + + + + + + + + + + + + + + +
NameDescriptionDefault ValuePossible Data TypesOptionalDynamic
arg

The value that should be used to calculate the standard deviation.

INT
LONG
DOUBLE
FLOAT
NoYes
+ +Examples +EXAMPLE 1 +``` +from inputStream +select stddev(temp) as stdTemp +insert into outputStream; +``` +

+

stddev(temp) returns the calculated standard deviation of temp for all the events based on their arrival and expiry.

+

+### sum *(Aggregate Function)* +

+

Returns the sum for all the events.

+

+Syntax + +``` + sum( arg) +``` + +QUERY PARAMETERS + + + + + + + + + + + + + + + + + +
NameDescriptionDefault ValuePossible Data TypesOptionalDynamic
arg

The value that needs to be summed.

INT
LONG
DOUBLE
FLOAT
NoYes
+ +Examples +EXAMPLE 1 +``` +from inputStream +select sum(volume) as sumOfVolume +insert into outputStream; +``` +

+

This will returns the sum of volume values as a long value for each event arrival and expiry.

+

+### unionSet *(Aggregate Function)* +

+

Union multiple sets.
 This attribute aggregator maintains a union of sets. The given input set is put into the union set and the union set is returned.

+

+Syntax + +``` + unionSet( set) +``` + +QUERY PARAMETERS + + + + + + + + + + + + + + + + + +
NameDescriptionDefault ValuePossible Data TypesOptionalDynamic
set

The java.util.Set object that needs to be added into the union set.

OBJECTNoYes
+ +Examples +EXAMPLE 1 +``` +from stockStream +select createSet(symbol) as initialSet +insert into initStream + +from initStream#window.timeBatch(10 sec) +select unionSet(initialSet) as distinctSymbols +insert into distinctStockStream; +``` +

+

distinctStockStream will return the set object which contains the distinct set of stock symbols received during a sliding window of 10 seconds.

+

+### UUID *(Function)* +

+

Generates a UUID (Universally Unique Identifier).

+

+Syntax + +``` + UUID() +``` + +Examples +EXAMPLE 1 +``` +from TempStream +select convert(roomNo, 'string') as roomNo, temp, UUID() as messageID +insert into RoomTempStream; +``` +

+

This will converts a room number to string, introducing a message ID to each event asUUID() returns a34eec40-32c2-44fe-8075-7f4fde2e2dd8

from TempStream
select convert(roomNo, 'string') as roomNo, temp, UUID() as messageID
insert into RoomTempStream;

+

+### cast *(Function)* +

+

Converts the first parameter according to the cast.to parameter. Incompatible arguments cause Class Cast exceptions if further processed. This function is used with map extension that returns attributes of the object type. You can use this function to cast the object to an accurate and concrete type.

+

+Syntax + +``` + cast( to.be.caster, cast.to) +``` + +QUERY PARAMETERS + + + + + + + + + + + + + + + + + + + + + + + + + +
NameDescriptionDefault ValuePossible Data TypesOptionalDynamic
to.be.caster

This specifies the attribute to be casted.

INT
LONG
DOUBLE
FLOAT
STRING
BOOL
OBJECT
NoYes
cast.to

A string constant parameter expressing the cast to type using one of the following strings values: int, long, float, double, string, bool.

STRINGNoYes
+ +Examples +EXAMPLE 1 +``` +from fooStream +select symbol as name, cast(temp, 'double') as temp +insert into barStream; +``` +

+

This will cast the fooStream temp field value into 'double' format.

+

+### coalesce *(Function)* +

+

Returns the value of the first input parameter that is not null, and all input parameters have to be on the same type.

+

+Syntax + +``` + coalesce( arg, ...) +``` + +QUERY PARAMETERS + + + + + + + + + + + + + + + + + +
NameDescriptionDefault ValuePossible Data TypesOptionalDynamic
arg

This function accepts one or more parameters. They can belong to any one of the available types. All the specified parameters should be of the same type.

INT
LONG
DOUBLE
FLOAT
STRING
BOOL
OBJECT
NoYes
+ +Examples +EXAMPLE 1 +``` +from fooStream +select coalesce('123', null, '789') as value +insert into barStream; +``` +

+

This will returns first null value 123.

+

+EXAMPLE 2 +``` +from fooStream +select coalesce(null, 76, 567) as value +insert into barStream; +``` +

+

This will returns first null value 76.

+

+EXAMPLE 3 +``` +from fooStream +select coalesce(null, null, null) as value +insert into barStream; +``` +

+

This will returns null as there are no notnull values.

+

+### convert *(Function)* +

+

Converts the first input parameter according to the convertedTo parameter.

+

+Syntax + +``` + convert( to.be.converted, converted.to) +``` + +QUERY PARAMETERS + + + + + + + + + + + + + + + + + + + + + + + + + +
NameDescriptionDefault ValuePossible Data TypesOptionalDynamic
to.be.converted

This specifies the value to be converted.

INT
LONG
DOUBLE
FLOAT
STRING
BOOL
NoYes
converted.to

A string constant parameter to which type the attribute need to be converted using one of the following strings values: 'int', 'long', 'float', 'double', 'string', 'bool'.

STRINGNoYes
+ +Examples +EXAMPLE 1 +``` +from fooStream +select convert(temp, 'double') as temp +insert into barStream; +``` +

+

This will convert fooStream temp value into 'double'.

+

+EXAMPLE 2 +``` +from fooStream +select convert(temp, 'int') as temp +insert into barStream; +``` +

+

This will convert fooStream temp value into 'int' (value = "convert(45.9, 'int') returns 46").

+

+### createSet *(Function)* +

+

Includes the given input parameter in a java.util.HashSet and returns the set.

+

+Syntax + +``` + createSet( input) +``` + +QUERY PARAMETERS + + + + + + + + + + + + + + + + + +
NameDescriptionDefault ValuePossible Data TypesOptionalDynamic
input

The input that needs to be added into the set.

INT
LONG
DOUBLE
FLOAT
STRING
BOOL
NoYes
+ +Examples +EXAMPLE 1 +``` +from stockStream +select createSet(symbol) as initialSet +insert into initStream; +``` +

+

For every incoming stockStream event, the initStream stream will produce a set object having only one element: the symbol in the incoming stockStream.

+

+### currentTimeMillis *(Function)* +

+

Returns the current timestamp of siddhi application in milliseconds.

+

+Syntax + +``` + currentTimeMillis() +``` + +Examples +EXAMPLE 1 +``` +from fooStream +select symbol as name, currentTimeMillis() as eventTimestamp +insert into barStream; +``` +

+

This will extract current siddhi application timestamp.

+

+### default *(Function)* +

+

Checks if the 'attribute' parameter is null and if so returns the value of the 'default' parameter

+

+Syntax + +``` + default( attribute, default) +``` + +QUERY PARAMETERS + + + + + + + + + + + + + + + + + + + + + + + + + +
NameDescriptionDefault ValuePossible Data TypesOptionalDynamic
attribute

The attribute that could be null.

INT
LONG
DOUBLE
FLOAT
STRING
BOOL
OBJECT
NoYes
default

The default value that will be used when 'attribute' parameter is null

INT
LONG
DOUBLE
FLOAT
STRING
BOOL
OBJECT
NoYes
+ +Examples +EXAMPLE 1 +``` +from TempStream +select default(temp, 0.0) as temp, roomNum +insert into StandardTempStream; +``` +

+

This will replace TempStream's temp attribute with default value if the temp is null.

+

+### eventTimestamp *(Function)* +

+

Returns the timestamp of the processed event.

+

+Syntax + +``` + eventTimestamp() +``` + +Examples +EXAMPLE 1 +``` +from fooStream +select symbol as name, eventTimestamp() as eventTimestamp +insert into barStream; +``` +

+

This will extract current events timestamp.

+

+### ifThenElse *(Function)* +

+

Evaluates the 'condition' parameter and returns value of the 'if.expression' parameter if the condition is true, or returns value of the 'else.expression' parameter if the condition is false. Here both 'if.expression' and 'else.expression' should be of the same type.

+

+Syntax + +``` + ifThenElse( condition, if.expression, else.expression) +``` + +QUERY PARAMETERS + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameDescriptionDefault ValuePossible Data TypesOptionalDynamic
condition

This specifies the if then else condition value.

BOOLNoYes
if.expression

This specifies the value to be returned if the value of the condition parameter is true.

INT
LONG
DOUBLE
FLOAT
STRING
BOOL
OBJECT
NoYes
else.expression

This specifies the value to be returned if the value of the condition parameter is false.

INT
LONG
DOUBLE
FLOAT
STRING
BOOL
OBJECT
NoYes
+ +Examples +EXAMPLE 1 +``` +@info(name = 'query1') +from sensorEventStream +select sensorValue, ifThenElse(sensorValue>35,'High','Low') as status +insert into outputStream; +``` +

+

This will returns High if sensorValue = 50.

+

+EXAMPLE 2 +``` +@info(name = 'query1') +from sensorEventStream +select sensorValue, ifThenElse(voltage < 5, 0, 1) as status +insert into outputStream; +``` +

+

This will returns 1 if voltage= 12.

+

+EXAMPLE 3 +``` +@info(name = 'query1') +from userEventStream +select userName, ifThenElse(password == 'admin', true, false) as passwordState +insert into outputStream; +``` +

+

This will returns passwordState as true if password = admin.

+

+### instanceOfBoolean *(Function)* +

+

Checks whether the parameter is an instance of Boolean or not.

+

+Syntax + +``` + instanceOfBoolean( arg) +``` + +QUERY PARAMETERS + + + + + + + + + + + + + + + + + +
NameDescriptionDefault ValuePossible Data TypesOptionalDynamic
arg

The parameter to be checked.

INT
LONG
DOUBLE
FLOAT
STRING
BOOL
OBJECT
NoYes
+ +Examples +EXAMPLE 1 +``` +from fooStream +select instanceOfBoolean(switchState) as state +insert into barStream; +``` +

+

This will return true if the value of switchState is true.

+

+EXAMPLE 2 +``` +from fooStream +select instanceOfBoolean(value) as state +insert into barStream; +``` +

+

if the value = 32 then this will returns false as the value is not an instance of the boolean.

+

+### instanceOfDouble *(Function)* +

+

Checks whether the parameter is an instance of Double or not.

+

+Syntax + +``` + instanceOfDouble( arg) +``` + +QUERY PARAMETERS + + + + + + + + + + + + + + + + + +
NameDescriptionDefault ValuePossible Data TypesOptionalDynamic
arg

The parameter to be checked.

INT
LONG
DOUBLE
FLOAT
STRING
BOOL
OBJECT
NoYes
+ +Examples +EXAMPLE 1 +``` +from fooStream +select instanceOfDouble(value) as state +insert into barStream; +``` +

+

This will return true if the value field format is double ex : 56.45.

+

+EXAMPLE 2 +``` +from fooStream +select instanceOfDouble(switchState) as state +insert into barStream; +``` +

+

if the switchState = true then this will returns false as the value is not an instance of the double.

+

+### instanceOfFloat *(Function)* +

+

Checks whether the parameter is an instance of Float or not.

+

+Syntax + +``` + instanceOfFloat( arg) +``` + +QUERY PARAMETERS + + + + + + + + + + + + + + + + + +
NameDescriptionDefault ValuePossible Data TypesOptionalDynamic
arg

The parameter to be checked.

INT
LONG
DOUBLE
FLOAT
STRING
BOOL
OBJECT
NoYes
+ +Examples +EXAMPLE 1 +``` +from fooStream +select instanceOfFloat(value) as state +insert into barStream; +``` +

+

This will return true if the value field format is float ex : 56.45f.

+

+EXAMPLE 2 +``` +from fooStream +select instanceOfFloat(switchState) as state +insert into barStream; +``` +

+

if the switchState = true then this will returns false as the value is an instance of the boolean not a float.

+

+### instanceOfInteger *(Function)* +

+

Checks whether the parameter is an instance of Integer or not.

+

+Syntax + +``` + instanceOfInteger( arg) +``` + +QUERY PARAMETERS + + + + + + + + + + + + + + + + + +
NameDescriptionDefault ValuePossible Data TypesOptionalDynamic
arg

The parameter to be checked.

INT
LONG
DOUBLE
FLOAT
STRING
BOOL
OBJECT
NoYes
+ +Examples +EXAMPLE 1 +``` +from fooStream +select instanceOfInteger(value) as state +insert into barStream; +``` +

+

This will return true if the value field format is integer.

+

+EXAMPLE 2 +``` +from fooStream +select instanceOfInteger(switchState) as state +insert into barStream; +``` +

+

if the switchState = true then this will returns false as the value is an instance of the boolean not a long.

+

+### instanceOfLong *(Function)* +

+

Checks whether the parameter is an instance of Long or not.

+

+Syntax + +``` + instanceOfLong( arg) +``` + +QUERY PARAMETERS + + + + + + + + + + + + + + + + + +
NameDescriptionDefault ValuePossible Data TypesOptionalDynamic
arg

The parameter to be checked.

INT
LONG
DOUBLE
FLOAT
STRING
BOOL
OBJECT
NoYes
+ +Examples +EXAMPLE 1 +``` +from fooStream +select instanceOfLong(value) as state +insert into barStream; +``` +

+

This will return true if the value field format is long ex : 56456l.

+

+EXAMPLE 2 +``` +from fooStream +select instanceOfLong(switchState) as state +insert into barStream; +``` +

+

if the switchState = true then this will returns false as the value is an instance of the boolean not a long.

+

+### instanceOfString *(Function)* +

+

Checks whether the parameter is an instance of String or not.

+

+Syntax + +``` + instanceOfString( arg) +``` + +QUERY PARAMETERS + + + + + + + + + + + + + + + + + +
NameDescriptionDefault ValuePossible Data TypesOptionalDynamic
arg

The parameter to be checked.

INT
LONG
DOUBLE
FLOAT
STRING
BOOL
OBJECT
NoYes
+ +Examples +EXAMPLE 1 +``` +from fooStream +select instanceOfString(value) as state +insert into barStream; +``` +

+

This will return true if the value field format is string ex : 'test'.

+

+EXAMPLE 2 +``` +from fooStream +select instanceOfString(switchState) as state +insert into barStream; +``` +

+

if the switchState = true then this will returns false as the value is an instance of the boolean not a string.

+

+### maximum *(Function)* +

+

Returns the maximum value of the input parameters.

+

+Syntax + +``` + maximum( arg, ...) +``` + +QUERY PARAMETERS + + + + + + + + + + + + + + + + + +
NameDescriptionDefault ValuePossible Data TypesOptionalDynamic
arg

This function accepts one or more parameters. They can belong to any one of the available types. All the specified parameters should be of the same type.

INT
LONG
DOUBLE
FLOAT
NoYes
+ +Examples +EXAMPLE 1 +``` +@info(name = 'query1') from inputStream +select maximum(price1, price2, price3) as max +insert into outputStream; +``` +

+

This will returns the maximum value of the input parameters price1, price2, price3.

+

+### minimum *(Function)* +

+

Returns the minimum value of the input parameters.

+

+Syntax + +``` + minimum( arg, ...) +``` + +QUERY PARAMETERS + + + + + + + + + + + + + + + + + +
NameDescriptionDefault ValuePossible Data TypesOptionalDynamic
arg

This function accepts one or more parameters. They can belong to any one of the available types. All the specified parameters should be of the same type.

INT
LONG
DOUBLE
FLOAT
NoYes
+ +Examples +EXAMPLE 1 +``` +@info(name = 'query1') from inputStream +select maximum(price1, price2, price3) as max +insert into outputStream; +``` +

+

This will returns the minimum value of the input parameters price1, price2, price3.

+

+### sizeOfSet *(Function)* +

+

Returns the size of an object of type java.util.Set.

+

+Syntax + +``` + sizeOfSet( set) +``` + +QUERY PARAMETERS + + + + + + + + + + + + + + + + + +
NameDescriptionDefault ValuePossible Data TypesOptionalDynamic
set

The set object. This parameter should be of type java.util.Set. A set object may be created by the 'set' attribute aggregator in Siddhi.

OBJECTNoYes
+ +Examples +EXAMPLE 1 +``` +from stockStream +select initSet(symbol) as initialSet +insert into initStream; + +;from initStream#window.timeBatch(10 sec) +select union(initialSet) as distinctSymbols +insert into distinctStockStream; + +from distinctStockStream +select sizeOfSet(distinctSymbols) sizeOfSymbolSet +insert into sizeStream; +``` +

+

The sizeStream stream will output the number of distinct stock symbols received during a sliding window of 10 seconds.

+

+### pol2Cart *(Stream Function)* +

+

The pol2Cart function calculating the cartesian coordinates x & y for the given theta, rho coordinates and adding them as new attributes to the existing events.

+

+Syntax + +``` +pol2Cart( theta, rho) +pol2Cart( theta, rho, z) +``` + +QUERY PARAMETERS + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameDescriptionDefault ValuePossible Data TypesOptionalDynamic
theta

The theta value of the coordinates.

DOUBLENoYes
rho

The rho value of the coordinates.

DOUBLENoYes
z

z value of the cartesian coordinates.

If z value is not given, drop the third parameter of the output.DOUBLEYesYes
+ +Examples +EXAMPLE 1 +``` +from PolarStream#pol2Cart(theta, rho) +select x, y +insert into outputStream ; +``` +

+

This will return cartesian coordinates (4.99953024681082, 0.06853693328228748) for theta: 0.7854 and rho: 5.

+

+EXAMPLE 2 +``` +from PolarStream#pol2Cart(theta, rho, 3.4) +select x, y, z +insert into outputStream ; +``` +

+

This will return cartesian coordinates (4.99953024681082, 0.06853693328228748, 3.4)for theta: 0.7854 and rho: 5 and z: 3.4.

+

+### log *(Stream Processor)* +

+

The logger logs the message on the given priority with or without processed event.

+

+Syntax + +``` +log() +log( log.message) +log( is.event.logged) +log( log.message, is.event.logged) +log( priority, log.message) +log( priority, log.message, is.event.logged) +``` + +QUERY PARAMETERS + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameDescriptionDefault ValuePossible Data TypesOptionalDynamic
priority

The priority/type of this log message (INFO, DEBUG, WARN, FATAL, ERROR, OFF, TRACE).

INFOSTRINGYesNo
log.message

This message will be logged.

:STRINGYesYes
is.event.logged

To log the processed event.

trueBOOLYesNo
+ +Examples +EXAMPLE 1 +``` +from fooStream#log("INFO", "Sample Event :", true) +select * +insert into barStream; +``` +

+

This will log as INFO with the message "Sample Event :" + fooStream:events.

+

+EXAMPLE 2 +``` +from fooStream#log("Sample Event :", true) +select * +insert into barStream; +``` +

+

This will logs with default log level as INFO.

+

+EXAMPLE 3 +``` +from fooStream#log("Sample Event :", fasle) +select * +insert into barStream; +``` +

+

This will only log message.

+

+EXAMPLE 4 +``` +from fooStream#log(true) +select * +insert into barStream; +``` +

+

This will only log fooStream:events.

+

+EXAMPLE 5 +``` +from fooStream#log() +select * +insert into barStream; +``` +

+

This will only log fooStream:events.

+

+EXAMPLE 6 +``` +from fooStream#log("Sample Event :") +select * +insert into barStream; +``` +

+

This will log message and fooStream:events.

+

+### batch *(Window)* +

+

A window that holds an incoming events batch. When a new set of events arrives, the previously arrived old events will be expired. Batch window can be used to aggregate events that comes in batches. If it has the parameter length specified, then batch window process the batch as several chunks.

+

+Syntax + +``` +batch() +batch( window.length) +``` + +QUERY PARAMETERS + + + + + + + + + + + + + + + + + +
NameDescriptionDefault ValuePossible Data TypesOptionalDynamic
window.length

The length of a chunk

If length value was not given it assign 0 as length and process the whole batch as onceINTYesNo
+ +Examples +EXAMPLE 1 +``` +define stream consumerItemStream (itemId string, price float) + +from consumerItemStream#window.batch() +select price, str:groupConcat(itemId) as itemIds +group by price +insert into outputStream; +``` +

+

This will output comma separated items IDs that have the same price for each incoming batch of events.

+

+### cron *(Window)* +

+

This window outputs the arriving events as and when they arrive, and resets (expires) the window periodically based on the given cron expression.

+

+Syntax + +``` +cron( cron.expression) +``` + +QUERY PARAMETERS + + + + + + + + + + + + + + + + + +
NameDescriptionDefault ValuePossible Data TypesOptionalDynamic
cron.expression

The cron expression that resets the window.

STRINGNoNo
+ +Examples +EXAMPLE 1 +``` +define stream InputEventStream (symbol string, price float, volume int); + +@info(name = 'query1') +from InputEventStream#cron('*/5 * * * * ?') +select symbol, sum(price) as totalPrice +insert into OutputStream; +``` +

+

This let the totalPrice to gradually increase and resets to zero as a batch every 5 seconds.

+

+EXAMPLE 2 +``` +define stream StockEventStream (symbol string, price float, volume int) +define window StockEventWindow (symbol string, price float, volume int) cron('*/5 * * * * ?'); + +@info(name = 'query0') +from StockEventStream +insert into StockEventWindow; + +@info(name = 'query1') +from StockEventWindow +select symbol, sum(price) as totalPrice +insert into OutputStream ; +``` +

+

The defined window will let the totalPrice to gradually increase and resets to zero as a batch every 5 seconds.

+

+### delay *(Window)* +

+

A delay window holds events for a specific time period that is regarded as a delay period before processing them.

+

+Syntax + +``` +delay( window.delay) +``` + +QUERY PARAMETERS + + + + + + + + + + + + + + + + + +
NameDescriptionDefault ValuePossible Data TypesOptionalDynamic
window.delay

The time period (specified in sec, min, ms) for which the window should delay the events.

INT
LONG
TIME
NoNo
+ +Examples +EXAMPLE 1 +``` +define window delayWindow(symbol string, volume int) delay(1 hour); +define stream PurchaseStream(symbol string, volume int); +define stream DeliveryStream(symbol string); +define stream OutputStream(symbol string); + +@info(name='query1') +from PurchaseStream +select symbol, volume +insert into delayWindow; + +@info(name='query2') +from delayWindow join DeliveryStream +on delayWindow.symbol == DeliveryStream.symbol +select delayWindow.symbol +insert into OutputStream; +``` +

+

In this example, purchase events that arrive in the 'PurchaseStream' stream are directed to a delay window. At any given time, this delay window holds purchase events that have arrived within the last hour. These purchase events in the window are matched by the 'symbol' attribute, with delivery events that arrive in the 'DeliveryStream' stream. This monitors whether the delivery of products is done with a minimum delay of one hour after the purchase.

+

+### externalTime *(Window)* +

+

A sliding time window based on external time. It holds events that arrived during the last windowTime period from the external timestamp, and gets updated on every monotonically increasing timestamp.

+

+Syntax + +``` +externalTime( timestamp, window.time) +``` + +QUERY PARAMETERS + + + + + + + + + + + + + + + + + + + + + + + + + +
NameDescriptionDefault ValuePossible Data TypesOptionalDynamic
timestamp

The time which the window determines as current time and will act upon. The value of this parameter should be monotonically increasing.

LONGNoYes
window.time

The sliding time period for which the window should hold events.

INT
LONG
TIME
NoNo
+ +Examples +EXAMPLE 1 +``` +define window cseEventWindow (symbol string, price float, volume int) externalTime(eventTime, 20 sec) output expired events; + +@info(name = 'query0') +from cseEventStream +insert into cseEventWindow; + +@info(name = 'query1') +from cseEventWindow +select symbol, sum(price) as price +insert expired events into outputStream ; +``` +

+

processing events arrived within the last 20 seconds from the eventTime and output expired events.

+

+### externalTimeBatch *(Window)* +

+

A batch (tumbling) time window based on external time, that holds events arrived during windowTime periods, and gets updated for every windowTime.

+

+Syntax + +``` +externalTimeBatch( timestamp, window.time) +externalTimeBatch( timestamp, window.time, start.time) +externalTimeBatch( timestamp, window.time, start.time, timeout) +externalTimeBatch( timestamp, window.time, start.time, timeout, replace.with.batchtime) +``` + +QUERY PARAMETERS + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameDescriptionDefault ValuePossible Data TypesOptionalDynamic
timestamp

The time which the window determines as current time and will act upon. The value of this parameter should be monotonically increasing.

LONGNoYes
window.time

The batch time period for which the window should hold events.

INT
LONG
TIME
NoNo
start.time

User defined start time. This could either be a constant (of type int, long or time) or an attribute of the corresponding stream (of type long). If an attribute is provided, initial value of attribute would be considered as startTime.

Timestamp of first eventINT
LONG
TIME
YesYes
timeout

Time to wait for arrival of new event, before flushing and giving output for events belonging to a specific batch.

System waits till an event from next batch arrives to flush current batchINT
LONG
TIME
YesNo
replace.with.batchtime

This indicates to replace the expired event timeStamp as the batch end timeStamp

System waits till an event from next batch arrives to flush current batchBOOLYesNo
+ +Examples +EXAMPLE 1 +``` +define window cseEventWindow (symbol string, price float, volume int) externalTimeBatch(eventTime, 1 sec) output expired events; +@info(name = 'query0') +from cseEventStream +insert into cseEventWindow; +@info(name = 'query1') +from cseEventWindow +select symbol, sum(price) as price +insert expired events into outputStream ; +``` +

+

This will processing events that arrive every 1 seconds from the eventTime.

+

+EXAMPLE 2 +``` +define window cseEventWindow (symbol string, price float, volume int) externalTimeBatch(eventTime, 20 sec, 0) output expired events; +``` +

+

This will processing events that arrive every 1 seconds from the eventTime. Starts on 0th millisecond of an hour.

+

+EXAMPLE 3 +``` +define window cseEventWindow (symbol string, price float, volume int) externalTimeBatch(eventTime, 2 sec, eventTimestamp, 100) output expired events; +``` +

+

This will processing events that arrive every 2 seconds from the eventTim. Considers the first event's eventTimestamp value as startTime. Waits 100 milliseconds for the arrival of a new event before flushing current batch.

+

+### frequent *(Window)* +

Deprecated

+

+

This window returns the latest events with the most frequently occurred value for a given attribute(s). Frequency calculation for this window processor is based on Misra-Gries counting algorithm.

+

+Syntax + +``` +frequent( event.count) +frequent( event.count, attribute) +``` + +QUERY PARAMETERS + + + + + + + + + + + + + + + + + + + + + + + + + +
NameDescriptionDefault ValuePossible Data TypesOptionalDynamic
event.count

The number of most frequent events to be emitted to the stream.

INTNoNo
attribute

The attributes to group the events. If no attributes are given, the concatenation of all the attributes of the event is considered.

The concatenation of all the attributes of the event is considered.STRINGYesYes
+ +Examples +EXAMPLE 1 +``` +@info(name = 'query1') +from purchase[price >= 30]#window.frequent(2) +select cardNo, price +insert all events into PotentialFraud; +``` +

+

This will returns the 2 most frequent events.

+

+EXAMPLE 2 +``` +@info(name = 'query1') +from purchase[price >= 30]#window.frequent(2, cardNo) +select cardNo, price +insert all events into PotentialFraud; +``` +

+

This will returns the 2 latest events with the most frequently appeared card numbers.

+

+### length *(Window)* +

+

A sliding length window that holds the last 'window.length' events at a given time, and gets updated for each arrival and expiry.

+

+Syntax + +``` +length( window.length) +``` + +QUERY PARAMETERS + + + + + + + + + + + + + + + + + +
NameDescriptionDefault ValuePossible Data TypesOptionalDynamic
window.length

The number of events that should be included in a sliding length window.

INTNoNo
+ +Examples +EXAMPLE 1 +``` +define window StockEventWindow (symbol string, price float, volume int) length(10) output all events; + +@info(name = 'query0') +from StockEventStream +insert into StockEventWindow; +@info(name = 'query1') + +from StockEventWindow +select symbol, sum(price) as price +insert all events into outputStream ; +``` +

+

This will process last 10 events in a sliding manner.

+

+### lengthBatch *(Window)* +

+

A batch (tumbling) length window that holds and process a number of events as specified in the window.length.

+

+Syntax + +``` +lengthBatch( window.length) +lengthBatch( window.length, stream.current.event) +``` + +QUERY PARAMETERS + + + + + + + + + + + + + + + + + + + + + + + + + +
NameDescriptionDefault ValuePossible Data TypesOptionalDynamic
window.length

The number of events the window should tumble.

INTNoNo
stream.current.event

Let the window stream the current events out as and when they arrive to the window while expiring them in batches.

falseBOOLYesNo
+ +Examples +EXAMPLE 1 +``` +define stream InputEventStream (symbol string, price float, volume int); + +@info(name = 'query1') +from InputEventStream#lengthBatch(10) +select symbol, sum(price) as price +insert into OutputStream; +``` +

+

This collect and process 10 events as a batch and output them.

+

+EXAMPLE 2 +``` +define stream InputEventStream (symbol string, price float, volume int); + +@info(name = 'query1') +from InputEventStream#lengthBatch(10, true) +select symbol, sum(price) as sumPrice +insert into OutputStream; +``` +

+

This window sends the arriving events directly to the output letting the sumPrice to increase gradually, after every 10 events it clears the window as a batch and resets the sumPrice to zero.

+

+EXAMPLE 3 +``` +define stream InputEventStream (symbol string, price float, volume int); +define window StockEventWindow (symbol string, price float, volume int) lengthBatch(10) output all events; + +@info(name = 'query0') +from InputEventStream +insert into StockEventWindow; + +@info(name = 'query1') +from StockEventWindow +select symbol, sum(price) as price +insert all events into OutputStream ; +``` +

+

This uses an defined window to process 10 events as a batch and output all events.

+

+### lossyFrequent *(Window)* +

Deprecated

+

+

This window identifies and returns all the events of which the current frequency exceeds the value specified for the supportThreshold parameter.

+

+Syntax + +``` +lossyFrequent( support.threshold) +lossyFrequent( support.threshold, error.bound) +lossyFrequent( support.threshold, error.bound, attribute) +``` + +QUERY PARAMETERS + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameDescriptionDefault ValuePossible Data TypesOptionalDynamic
support.threshold

The support threshold value.

DOUBLENoNo
error.bound

The error bound value.

`support.threshold`/10DOUBLEYesNo
attribute

The attributes to group the events. If no attributes are given, the concatenation of all the attributes of the event is considered.

The concatenation of all the attributes of the event is considered.STRINGYesYes
+ +Examples +EXAMPLE 1 +``` +define stream purchase (cardNo string, price float); +define window purchaseWindow (cardNo string, price float) lossyFrequent(0.1, 0.01); +@info(name = 'query0') +from purchase[price >= 30] +insert into purchaseWindow; +@info(name = 'query1') +from purchaseWindow +select cardNo, price +insert all events into PotentialFraud; +``` +

+

lossyFrequent(0.1, 0.01) returns all the events of which the current frequency exceeds 0.1, with an error bound of 0.01.

+

+EXAMPLE 2 +``` +define stream purchase (cardNo string, price float); +define window purchaseWindow (cardNo string, price float) lossyFrequent(0.3, 0.05, cardNo); +@info(name = 'query0') +from purchase[price >= 30] +insert into purchaseWindow; +@info(name = 'query1') +from purchaseWindow +select cardNo, price +insert all events into PotentialFraud; +``` +

+

lossyFrequent(0.3, 0.05, cardNo) returns all the events of which the cardNo attributes frequency exceeds 0.3, with an error bound of 0.05.

+

+### session *(Window)* +

+

This is a session window that holds events that belong to a specific session. The events that belong to a specific session are identified by a grouping attribute (i.e., a session key). A session gap period is specified to determine the time period after which the session is considered to be expired. A new event that arrives with a specific value for the session key is matched with the session window with the same session key.
 There can be out of order and late arrival of events, these events can arrive after the session is expired, to include those events to the matching session key specify a latency time period that is less than the session gap period.To have aggregate functions with session windows, the events need to be grouped by the session key via a 'group by' clause.

+

+Syntax + +``` +session( window.session) +session( window.session, window.key) +session( window.session, window.key, window.allowed.latency) +``` + +QUERY PARAMETERS + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameDescriptionDefault ValuePossible Data TypesOptionalDynamic
window.session

The time period for which the session considered is valid. This is specified in seconds, minutes, or milliseconds (i.e., 'min', 'sec', or 'ms'.

INT
LONG
TIME
NoNo
window.key

The grouping attribute for events.

default-keySTRINGYesYes
window.allowed.latency

This specifies the time period for which the session window is valid after the expiration of the session. The time period specified here should be less than the session time gap (which is specified via the 'window.session' parameter).

0INT
LONG
TIME
YesNo
+ +Examples +EXAMPLE 1 +``` +define stream PurchaseEventStream (user string, item_number int, price float, quantity int); + +@info(name='query0) +from PurchaseEventStream#window.session(5 sec, user, 2 sec) +select * +insert all events into OutputStream; +``` +

+

This query processes events that arrive at the PurchaseEvent input stream. The 'user' attribute is the session key, and the session gap is 5 seconds. '2 sec' is specified as the allowed latency. Therefore, events with the matching user name that arrive 2 seconds after the expiration of the session are also considered when performing aggregations for the session identified by the given user name.

+

+### sort *(Window)* +

+

This window holds a batch of events that equal the number specified as the windowLength and sorts them in the given order.

+

+Syntax + +``` +sort( window.length, attribute) +sort( window.length, attribute, order, ...) +sort( window.length, attribute, order, attribute, ...) +``` + +QUERY PARAMETERS + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameDescriptionDefault ValuePossible Data TypesOptionalDynamic
window.length

The size of the window length.

INTNoNo
attribute

The attribute that should be checked for the order.

The concatenation of all the attributes of the event is considered.STRING
DOUBLE
INT
LONG
FLOAT
LONG
NoYes
order

The order define as "asc" or "desc".

ascSTRINGYesNo
+ +Examples +EXAMPLE 1 +``` +define stream cseEventStream (symbol string, price float, volume long); +define window cseEventWindow (symbol string, price float, volume long) sort(2,volume, 'asc'); +@info(name = 'query0') +from cseEventStream +insert into cseEventWindow; +@info(name = 'query1') +from cseEventWindow +select volume +insert all events into outputStream ; +``` +

+

sort(5, price, 'asc') keeps the events sorted by price in the ascending order. Therefore, at any given time, the window contains the 5 lowest prices.

+

+### time *(Window)* +

+

A sliding time window that holds events that arrived during the last windowTime period at a given time, and gets updated for each event arrival and expiry.

+

+Syntax + +``` +time( window.time) +``` + +QUERY PARAMETERS + + + + + + + + + + + + + + + + + +
NameDescriptionDefault ValuePossible Data TypesOptionalDynamic
window.time

The sliding time period for which the window should hold events.

INT
LONG
TIME
NoNo
+ +Examples +EXAMPLE 1 +``` +define window cseEventWindow (symbol string, price float, volume int) time(20) output all events; +@info(name = 'query0') +from cseEventStream +insert into cseEventWindow; +@info(name = 'query1') +from cseEventWindow +select symbol, sum(price) as price +insert all events into outputStream ; +``` +

+

This will processing events that arrived within the last 20 milliseconds.

+

+### timeBatch *(Window)* +

+

A batch (tumbling) time window that holds and process events that arrive during 'window.time' period as a batch.

+

+Syntax + +``` +timeBatch( window.time) +timeBatch( window.time, start.time) +timeBatch( window.time, stream.current.event) +timeBatch( window.time, start.time, stream.current.event) +``` + +QUERY PARAMETERS + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameDescriptionDefault ValuePossible Data TypesOptionalDynamic
window.time

The batch time period in which the window process the events.

INT
LONG
TIME
NoNo
start.time

This specifies an offset in milliseconds in order to start the window at a time different to the standard time.

Timestamp of first eventINT
LONG
YesNo
stream.current.event

Let the window stream the current events out as and when they arrive to the window while expiring them in batches.

falseBOOLYesNo
+ +Examples +EXAMPLE 1 +``` +define stream InputEventStream (symbol string, price float, volume int); + +@info(name = 'query1') +from InputEventStream#timeBatch(20 sec) +select symbol, sum(price) as price +insert into OutputStream; +``` +

+

This collect and process incoming events as a batch every 20 seconds and output them.

+

+EXAMPLE 2 +``` +define stream InputEventStream (symbol string, price float, volume int); + +@info(name = 'query1') +from InputEventStream#timeBatch(20 sec, true) +select symbol, sum(price) as sumPrice +insert into OutputStream; +``` +

+

This window sends the arriving events directly to the output letting the sumPrice to increase gradually and on every 20 second interval it clears the window as a batch resetting the sumPrice to zero.

+

+EXAMPLE 3 +``` +define stream InputEventStream (symbol string, price float, volume int); +define window StockEventWindow (symbol string, price float, volume int) timeBatch(20 sec) output all events; + +@info(name = 'query0') +from InputEventStream +insert into StockEventWindow; + +@info(name = 'query1') +from StockEventWindow +select symbol, sum(price) as price +insert all events into OutputStream ; +``` +

+

This uses an defined window to process events arrived every 20 seconds as a batch and output all events.

+

+### timeLength *(Window)* +

+

A sliding time window that, at a given time holds the last window.length events that arrived during last window.time period, and gets updated for every event arrival and expiry.

+

+Syntax + +``` +timeLength( window.time, window.length) +``` + +QUERY PARAMETERS + + + + + + + + + + + + + + + + + + + + + + + + + +
NameDescriptionDefault ValuePossible Data TypesOptionalDynamic
window.time

The sliding time period for which the window should hold events.

INT
LONG
TIME
NoNo
window.length

The number of events that should be be included in a sliding length window..

INTNoNo
+ +Examples +EXAMPLE 1 +``` +define stream cseEventStream (symbol string, price float, volume int); +define window cseEventWindow (symbol string, price float, volume int) timeLength(2 sec, 10); +@info(name = 'query0') +from cseEventStream +insert into cseEventWindow; +@info(name = 'query1') +from cseEventWindow select symbol, price, volume +insert all events into outputStream; +``` +

+

window.timeLength(2 sec, 10) holds the last 10 events that arrived during last 2 seconds and gets updated for every event arrival and expiry.

+

+## Sink + +### inMemory *(Sink)* +

+

In-memory transport that can communicate with other in-memory transports within the same JVM, itis assumed that the publisher and subscriber of a topic uses same event schema (stream definition).

+

+Syntax + +``` +@sink(type="inMemory", topic="", @map(...))) +``` + +QUERY PARAMETERS + + + + + + + + + + + + + + + + + +
NameDescriptionDefault ValuePossible Data TypesOptionalDynamic
topic

Event will be delivered to allthe subscribers of the same topic

STRINGNoNo
+ +Examples +EXAMPLE 1 +``` +@sink(type='inMemory', @map(type='passThrough')) +define stream BarStream (symbol string, price float, volume long) +``` +

+

In this example BarStream uses inMemory transport which emit the Siddhi events internally without using external transport and transformation.

+

+### log *(Sink)* +

+

This is a sink that can be used as a logger. This will log the output events in the output stream with user specified priority and a prefix

+

+Syntax + +``` +@sink(type="log", priority="", prefix="", @map(...))) +``` + +QUERY PARAMETERS + + + + + + + + + + + + + + + + + + + + + + + + + +
NameDescriptionDefault ValuePossible Data TypesOptionalDynamic
priority

This will set the logger priority i.e log level. Accepted values are INFO, DEBUG, WARN, FATAL, ERROR, OFF, TRACE

INFOSTRINGYesNo
prefix

This will be the prefix to the output message. If the output stream has event [2,4] and the prefix is given as "Hello" then the log will show "Hello : [2,4]"

default prefix will be : STRINGYesNo
+ +Examples +EXAMPLE 1 +``` +@sink(type='log', prefix='My Log', priority='DEBUG') +define stream BarStream (symbol string, price float, volume long) +``` +

+

In this example BarStream uses log sink and the prefix is given as My Log. Also the priority is set to DEBUG.

+

+EXAMPLE 2 +``` +@sink(type='log', priority='DEBUG') +define stream BarStream (symbol string, price float, volume long) +``` +

+

In this example BarStream uses log sink and the priority is set to DEBUG. User has not specified prefix so the default prefix will be in the form <Siddhi App Name> : <Stream Name>

+

+EXAMPLE 3 +``` +@sink(type='log', prefix='My Log') +define stream BarStream (symbol string, price float, volume long) +``` +

+

In this example BarStream uses log sink and the prefix is given as My Log. User has not given a priority so it will be set to default INFO.

+

+EXAMPLE 4 +``` +@sink(type='log') +define stream BarStream (symbol string, price float, volume long) +``` +

+

In this example BarStream uses log sink. The user has not given prefix or priority so they will be set to their default values.

+

+## Sinkmapper + +### passThrough *(Sink Mapper)* +

+

Pass-through mapper passed events (Event[]) through without any mapping or modifications.

+

+Syntax + +``` +@sink(..., @map(type="passThrough") +``` + +Examples +EXAMPLE 1 +``` +@sink(type='inMemory', @map(type='passThrough')) +define stream BarStream (symbol string, price float, volume long); +``` +

+

In the following example BarStream uses passThrough outputmapper which emit Siddhi event directly without any transformation into sink.

+

+## Source + +### inMemory *(Source)* +

+

In-memory source that can communicate with other in-memory sinks within the same JVM, it is assumed that the publisher and subscriber of a topic uses same event schema (stream definition).

+

+Syntax + +``` +@source(type="inMemory", topic="", @map(...))) +``` + +QUERY PARAMETERS + + + + + + + + + + + + + + + + + +
NameDescriptionDefault ValuePossible Data TypesOptionalDynamic
topic

Subscribes to sent on the given topic.

STRINGNoNo
+ +Examples +EXAMPLE 1 +``` +@source(type='inMemory', @map(type='passThrough')) +define stream BarStream (symbol string, price float, volume long) +``` +

+

In this example BarStream uses inMemory transport which passes the received event internally without using external transport.

+

+## Sourcemapper + +### passThrough *(Source Mapper)* +

+

Pass-through mapper passed events (Event[]) through without any mapping or modifications.

+

+Syntax + +``` +@source(..., @map(type="passThrough") +``` + +Examples +EXAMPLE 1 +``` +@source(type='tcp', @map(type='passThrough')) +define stream BarStream (symbol string, price float, volume long); +``` +

+

In this example BarStream uses passThrough inputmapper which passes the received Siddhi event directly without any transformation into source.

+

diff --git a/docs/api/latest.md b/docs/api/latest.md index b226bfebd8..be2cdb0099 100644 --- a/docs/api/latest.md +++ b/docs/api/latest.md @@ -1,9 +1,11 @@ -# API Docs - v5.1.1 +# API Docs - v5.1.2 ## Core ### and *(Aggregate Function)* -

Returns the results of AND operation for all the events.

+

+

Returns the results of AND operation for all the events.

+

Syntax ``` @@ -22,7 +24,7 @@ arg - The value that needs to be AND operation. +

The value that needs to be AND operation.

BOOL No @@ -37,10 +39,13 @@ from cscStream#window.lengthBatch(10) select and(isFraud) as isFraudTransaction insert into alertStream; ``` -

This will returns the result for AND operation of isFraud values as a boolean value for event chunk expiry by window length batch.

- +

+

This will returns the result for AND operation of isFraud values as a boolean value for event chunk expiry by window length batch.

+

### avg *(Aggregate Function)* -

Calculates the average for all the events.

+

+

Calculates the average for all the events.

+

Syntax ``` @@ -59,7 +64,7 @@ insert into alertStream; arg - The value that need to be averaged. +

The value that need to be averaged.

INT
LONG
DOUBLE
FLOAT No @@ -74,10 +79,13 @@ from fooStream#window.timeBatch select avg(temp) as avgTemp insert into barStream; ``` -

avg(temp) returns the average temp value for all the events based on their arrival and expiry.

- +

+

avg(temp) returns the average temp value for all the events based on their arrival and expiry.

+

### count *(Aggregate Function)* -

Returns the count of all the events.

+

+

Returns the count of all the events.

+

Syntax ``` @@ -97,7 +105,7 @@ from fooStream#window.timeBatch arg - This function accepts one parameter. It can belong to any one of the available types. +

This function accepts one parameter. It can belong to any one of the available types.

INT
LONG
DOUBLE
FLOAT
STRING
BOOL
OBJECT Yes @@ -112,10 +120,13 @@ from fooStream#window.timeBatch(10 sec) select count() as count insert into barStream; ``` -

This will return the count of all the events for time batch in 10 seconds.

- +

+

This will return the count of all the events for time batch in 10 seconds.

+

### distinctCount *(Aggregate Function)* -

This returns the count of distinct occurrences for a given arg.

+

+

This returns the count of distinct occurrences for a given arg.

+

Syntax ``` @@ -134,7 +145,7 @@ insert into barStream; arg - The object for which the number of distinct occurences needs to be counted. +

The object for which the number of distinct occurences needs to be counted.

INT
LONG
DOUBLE
FLOAT
STRING No @@ -149,10 +160,13 @@ from fooStream select distinctcount(pageID) as count insert into barStream; ``` -

distinctcount(pageID) for the following output returns '3' when the available values are as follows.
 "WEB_PAGE_1"
 "WEB_PAGE_1"
 "WEB_PAGE_2"
 "WEB_PAGE_3"
 "WEB_PAGE_1"
 "WEB_PAGE_2"
 The three distinct occurences identified are 'WEB_PAGE_1', 'WEB_PAGE_2', and 'WEB_PAGE_3'.

- +

+

distinctcount(pageID) for the following output returns '3' when the available values are as follows.
 "WEB_PAGE_1"
 "WEB_PAGE_1"
 "WEB_PAGE_2"
 "WEB_PAGE_3"
 "WEB_PAGE_1"
 "WEB_PAGE_2"
 The three distinct occurences identified are 'WEB_PAGE_1', 'WEB_PAGE_2', and 'WEB_PAGE_3'.

+

### max *(Aggregate Function)* -

Returns the maximum value for all the events.

+

+

Returns the maximum value for all the events.

+

Syntax ``` @@ -171,7 +185,7 @@ insert into barStream; arg - The value that needs to be compared to find the maximum value. +

The value that needs to be compared to find the maximum value.

INT
LONG
DOUBLE
FLOAT No @@ -186,10 +200,13 @@ from fooStream#window.timeBatch(10 sec) select max(temp) as maxTemp insert into barStream; ``` -

max(temp) returns the maximum temp value recorded for all the events based on their arrival and expiry.

- +

+

max(temp) returns the maximum temp value recorded for all the events based on their arrival and expiry.

+

### maxForever *(Aggregate Function)* -

This is the attribute aggregator to store the maximum value for a given attribute throughout the lifetime of the query regardless of any windows in-front.

+

+

This is the attribute aggregator to store the maximum value for a given attribute throughout the lifetime of the query regardless of any windows in-front.

+

Syntax ``` @@ -208,7 +225,7 @@ insert into barStream; arg - The value that needs to be compared to find the maximum value. +

The value that needs to be compared to find the maximum value.

INT
LONG
DOUBLE
FLOAT No @@ -223,10 +240,13 @@ from inputStream select maxForever(temp) as max insert into outputStream; ``` -

maxForever(temp) returns the maximum temp value recorded for all the events throughout the lifetime of the query.

- +

+

maxForever(temp) returns the maximum temp value recorded for all the events throughout the lifetime of the query.

+

### min *(Aggregate Function)* -

Returns the minimum value for all the events.

+

+

Returns the minimum value for all the events.

+

Syntax ``` @@ -245,7 +265,7 @@ insert into outputStream; arg - The value that needs to be compared to find the minimum value. +

The value that needs to be compared to find the minimum value.

INT
LONG
DOUBLE
FLOAT No @@ -260,10 +280,13 @@ from inputStream select min(temp) as minTemp insert into outputStream; ``` -

min(temp) returns the minimum temp value recorded for all the events based on their arrival and expiry.

- +

+

min(temp) returns the minimum temp value recorded for all the events based on their arrival and expiry.

+

### minForever *(Aggregate Function)* -

This is the attribute aggregator to store the minimum value for a given attribute throughout the lifetime of the query regardless of any windows in-front.

+

+

This is the attribute aggregator to store the minimum value for a given attribute throughout the lifetime of the query regardless of any windows in-front.

+

Syntax ``` @@ -282,7 +305,7 @@ insert into outputStream; arg - The value that needs to be compared to find the minimum value. +

The value that needs to be compared to find the minimum value.

INT
LONG
DOUBLE
FLOAT No @@ -297,10 +320,13 @@ from inputStream select minForever(temp) as max insert into outputStream; ``` -

minForever(temp) returns the minimum temp value recorded for all the events throughoutthe lifetime of the query.

- +

+

minForever(temp) returns the minimum temp value recorded for all the events throughoutthe lifetime of the query.

+

### or *(Aggregate Function)* -

Returns the results of OR operation for all the events.

+

+

Returns the results of OR operation for all the events.

+

Syntax ``` @@ -319,7 +345,7 @@ insert into outputStream; arg - The value that needs to be OR operation. +

The value that needs to be OR operation.

BOOL No @@ -334,10 +360,13 @@ from cscStream#window.lengthBatch(10) select or(isFraud) as isFraudTransaction insert into alertStream; ``` -

This will returns the result for OR operation of isFraud values as a boolean value for event chunk expiry by window length batch.

- +

+

This will returns the result for OR operation of isFraud values as a boolean value for event chunk expiry by window length batch.

+

### stdDev *(Aggregate Function)* -

Returns the calculated standard deviation for all the events.

+

+

Returns the calculated standard deviation for all the events.

+

Syntax ``` @@ -356,7 +385,7 @@ insert into alertStream; arg - The value that should be used to calculate the standard deviation. +

The value that should be used to calculate the standard deviation.

INT
LONG
DOUBLE
FLOAT No @@ -371,10 +400,13 @@ from inputStream select stddev(temp) as stdTemp insert into outputStream; ``` -

stddev(temp) returns the calculated standard deviation of temp for all the events based on their arrival and expiry.

- +

+

stddev(temp) returns the calculated standard deviation of temp for all the events based on their arrival and expiry.

+

### sum *(Aggregate Function)* -

Returns the sum for all the events.

+

+

Returns the sum for all the events.

+

Syntax ``` @@ -393,7 +425,7 @@ insert into outputStream; arg - The value that needs to be summed. +

The value that needs to be summed.

INT
LONG
DOUBLE
FLOAT No @@ -408,10 +440,13 @@ from inputStream select sum(volume) as sumOfVolume insert into outputStream; ``` -

This will returns the sum of volume values as a long value for each event arrival and expiry.

- +

+

This will returns the sum of volume values as a long value for each event arrival and expiry.

+

### unionSet *(Aggregate Function)* -

Union multiple sets.
 This attribute aggregator maintains a union of sets. The given input set is put into the union set and the union set is returned.

+

+

Union multiple sets.
 This attribute aggregator maintains a union of sets. The given input set is put into the union set and the union set is returned.

+

Syntax ``` @@ -430,7 +465,7 @@ insert into outputStream; set - The java.util.Set object that needs to be added into the union set. +

The java.util.Set object that needs to be added into the union set.

OBJECT No @@ -449,10 +484,13 @@ from initStream#window.timeBatch(10 sec) select unionSet(initialSet) as distinctSymbols insert into distinctStockStream; ``` -

distinctStockStream will return the set object which contains the distinct set of stock symbols received during a sliding window of 10 seconds.

- +

+

distinctStockStream will return the set object which contains the distinct set of stock symbols received during a sliding window of 10 seconds.

+

### UUID *(Function)* -

Generates a UUID (Universally Unique Identifier).

+

+

Generates a UUID (Universally Unique Identifier).

+

Syntax ``` @@ -466,10 +504,13 @@ from TempStream select convert(roomNo, 'string') as roomNo, temp, UUID() as messageID insert into RoomTempStream; ``` -

This will converts a room number to string, introducing a message ID to each event asUUID() returns a34eec40-32c2-44fe-8075-7f4fde2e2dd8

from TempStream
select convert(roomNo, 'string') as roomNo, temp, UUID() as messageID
insert into RoomTempStream;

- +

+

This will converts a room number to string, introducing a message ID to each event asUUID() returns a34eec40-32c2-44fe-8075-7f4fde2e2dd8

from TempStream
select convert(roomNo, 'string') as roomNo, temp, UUID() as messageID
insert into RoomTempStream;

+

### cast *(Function)* -

Converts the first parameter according to the cast.to parameter. Incompatible arguments cause Class Cast exceptions if further processed. This function is used with map extension that returns attributes of the object type. You can use this function to cast the object to an accurate and concrete type.

+

+

Converts the first parameter according to the cast.to parameter. Incompatible arguments cause Class Cast exceptions if further processed. This function is used with map extension that returns attributes of the object type. You can use this function to cast the object to an accurate and concrete type.

+

Syntax ``` @@ -488,7 +529,7 @@ insert into RoomTempStream; to.be.caster - This specifies the attribute to be casted. +

This specifies the attribute to be casted.

INT
LONG
DOUBLE
FLOAT
STRING
BOOL
OBJECT No @@ -496,7 +537,7 @@ insert into RoomTempStream; cast.to - A string constant parameter expressing the cast to type using one of the following strings values: int, long, float, double, string, bool. +

A string constant parameter expressing the cast to type using one of the following strings values: int, long, float, double, string, bool.

STRING No @@ -511,10 +552,13 @@ from fooStream select symbol as name, cast(temp, 'double') as temp insert into barStream; ``` -

This will cast the fooStream temp field value into 'double' format.

- +

+

This will cast the fooStream temp field value into 'double' format.

+

### coalesce *(Function)* -

Returns the value of the first input parameter that is not null, and all input parameters have to be on the same type.

+

+

Returns the value of the first input parameter that is not null, and all input parameters have to be on the same type.

+

Syntax ``` @@ -533,7 +577,7 @@ insert into barStream; arg - This function accepts one or more parameters. They can belong to any one of the available types. All the specified parameters should be of the same type. +

This function accepts one or more parameters. They can belong to any one of the available types. All the specified parameters should be of the same type.

INT
LONG
DOUBLE
FLOAT
STRING
BOOL
OBJECT No @@ -548,26 +592,31 @@ from fooStream select coalesce('123', null, '789') as value insert into barStream; ``` -

This will returns first null value 123.

- +

+

This will returns first null value 123.

+

EXAMPLE 2 ``` from fooStream select coalesce(null, 76, 567) as value insert into barStream; ``` -

This will returns first null value 76.

- +

+

This will returns first null value 76.

+

EXAMPLE 3 ``` from fooStream select coalesce(null, null, null) as value insert into barStream; ``` -

This will returns null as there are no notnull values.

- +

+

This will returns null as there are no notnull values.

+

### convert *(Function)* -

Converts the first input parameter according to the convertedTo parameter.

+

+

Converts the first input parameter according to the convertedTo parameter.

+

Syntax ``` @@ -586,7 +635,7 @@ insert into barStream; to.be.converted - This specifies the value to be converted. +

This specifies the value to be converted.

INT
LONG
DOUBLE
FLOAT
STRING
BOOL No @@ -594,7 +643,7 @@ insert into barStream; converted.to - A string constant parameter to which type the attribute need to be converted using one of the following strings values: 'int', 'long', 'float', 'double', 'string', 'bool'. +

A string constant parameter to which type the attribute need to be converted using one of the following strings values: 'int', 'long', 'float', 'double', 'string', 'bool'.

STRING No @@ -609,18 +658,22 @@ from fooStream select convert(temp, 'double') as temp insert into barStream; ``` -

This will convert fooStream temp value into 'double'.

- +

+

This will convert fooStream temp value into 'double'.

+

EXAMPLE 2 ``` from fooStream select convert(temp, 'int') as temp insert into barStream; ``` -

This will convert fooStream temp value into 'int' (value = "convert(45.9, 'int') returns 46").

- +

+

This will convert fooStream temp value into 'int' (value = "convert(45.9, 'int') returns 46").

+

### createSet *(Function)* -

Includes the given input parameter in a java.util.HashSet and returns the set.

+

+

Includes the given input parameter in a java.util.HashSet and returns the set.

+

Syntax ``` @@ -639,7 +692,7 @@ insert into barStream; input - The input that needs to be added into the set. +

The input that needs to be added into the set.

INT
LONG
DOUBLE
FLOAT
STRING
BOOL No @@ -654,10 +707,13 @@ from stockStream select createSet(symbol) as initialSet insert into initStream; ``` -

For every incoming stockStream event, the initStream stream will produce a set object having only one element: the symbol in the incoming stockStream.

- +

+

For every incoming stockStream event, the initStream stream will produce a set object having only one element: the symbol in the incoming stockStream.

+

### currentTimeMillis *(Function)* -

Returns the current timestamp of siddhi application in milliseconds.

+

+

Returns the current timestamp of siddhi application in milliseconds.

+

Syntax ``` @@ -671,10 +727,13 @@ from fooStream select symbol as name, currentTimeMillis() as eventTimestamp insert into barStream; ``` -

This will extract current siddhi application timestamp.

- +

+

This will extract current siddhi application timestamp.

+

### default *(Function)* -

Checks if the 'attribute' parameter is null and if so returns the value of the 'default' parameter

+

+

Checks if the 'attribute' parameter is null and if so returns the value of the 'default' parameter

+

Syntax ``` @@ -693,7 +752,7 @@ insert into barStream; attribute - The attribute that could be null. +

The attribute that could be null.

INT
LONG
DOUBLE
FLOAT
STRING
BOOL
OBJECT No @@ -701,7 +760,7 @@ insert into barStream; default - The default value that will be used when 'attribute' parameter is null +

The default value that will be used when 'attribute' parameter is null

INT
LONG
DOUBLE
FLOAT
STRING
BOOL
OBJECT No @@ -716,10 +775,13 @@ from TempStream select default(temp, 0.0) as temp, roomNum insert into StandardTempStream; ``` -

This will replace TempStream's temp attribute with default value if the temp is null.

- +

+

This will replace TempStream's temp attribute with default value if the temp is null.

+

### eventTimestamp *(Function)* -

Returns the timestamp of the processed event.

+

+

Returns the timestamp of the processed event.

+

Syntax ``` @@ -733,10 +795,13 @@ from fooStream select symbol as name, eventTimestamp() as eventTimestamp insert into barStream; ``` -

This will extract current events timestamp.

- +

+

This will extract current events timestamp.

+

### ifThenElse *(Function)* -

Evaluates the 'condition' parameter and returns value of the 'if.expression' parameter if the condition is true, or returns value of the 'else.expression' parameter if the condition is false. Here both 'if.expression' and 'else.expression' should be of the same type.

+

+

Evaluates the 'condition' parameter and returns value of the 'if.expression' parameter if the condition is true, or returns value of the 'else.expression' parameter if the condition is false. Here both 'if.expression' and 'else.expression' should be of the same type.

+

Syntax ``` @@ -755,7 +820,7 @@ insert into barStream; condition - This specifies the if then else condition value. +

This specifies the if then else condition value.

BOOL No @@ -763,7 +828,7 @@ insert into barStream; if.expression - This specifies the value to be returned if the value of the condition parameter is true. +

This specifies the value to be returned if the value of the condition parameter is true.

INT
LONG
DOUBLE
FLOAT
STRING
BOOL
OBJECT No @@ -771,7 +836,7 @@ insert into barStream; else.expression - This specifies the value to be returned if the value of the condition parameter is false. +

This specifies the value to be returned if the value of the condition parameter is false.

INT
LONG
DOUBLE
FLOAT
STRING
BOOL
OBJECT No @@ -787,8 +852,9 @@ from sensorEventStream select sensorValue, ifThenElse(sensorValue>35,'High','Low') as status insert into outputStream; ``` -

This will returns High if sensorValue = 50.

- +

+

This will returns High if sensorValue = 50.

+

EXAMPLE 2 ``` @info(name = 'query1') @@ -796,8 +862,9 @@ from sensorEventStream select sensorValue, ifThenElse(voltage < 5, 0, 1) as status insert into outputStream; ``` -

This will returns 1 if voltage= 12.

- +

+

This will returns 1 if voltage= 12.

+

EXAMPLE 3 ``` @info(name = 'query1') @@ -805,10 +872,13 @@ from userEventStream select userName, ifThenElse(password == 'admin', true, false) as passwordState insert into outputStream; ``` -

This will returns passwordState as true if password = admin.

- +

+

This will returns passwordState as true if password = admin.

+

### instanceOfBoolean *(Function)* -

Checks whether the parameter is an instance of Boolean or not.

+

+

Checks whether the parameter is an instance of Boolean or not.

+

Syntax ``` @@ -827,7 +897,7 @@ insert into outputStream; arg - The parameter to be checked. +

The parameter to be checked.

INT
LONG
DOUBLE
FLOAT
STRING
BOOL
OBJECT No @@ -842,18 +912,22 @@ from fooStream select instanceOfBoolean(switchState) as state insert into barStream; ``` -

This will return true if the value of switchState is true.

- +

+

This will return true if the value of switchState is true.

+

EXAMPLE 2 ``` from fooStream select instanceOfBoolean(value) as state insert into barStream; ``` -

if the value = 32 then this will returns false as the value is not an instance of the boolean.

- +

+

if the value = 32 then this will returns false as the value is not an instance of the boolean.

+

### instanceOfDouble *(Function)* -

Checks whether the parameter is an instance of Double or not.

+

+

Checks whether the parameter is an instance of Double or not.

+

Syntax ``` @@ -872,7 +946,7 @@ insert into barStream; arg - The parameter to be checked. +

The parameter to be checked.

INT
LONG
DOUBLE
FLOAT
STRING
BOOL
OBJECT No @@ -887,18 +961,22 @@ from fooStream select instanceOfDouble(value) as state insert into barStream; ``` -

This will return true if the value field format is double ex : 56.45.

- +

+

This will return true if the value field format is double ex : 56.45.

+

EXAMPLE 2 ``` from fooStream select instanceOfDouble(switchState) as state insert into barStream; ``` -

if the switchState = true then this will returns false as the value is not an instance of the double.

- +

+

if the switchState = true then this will returns false as the value is not an instance of the double.

+

### instanceOfFloat *(Function)* -

Checks whether the parameter is an instance of Float or not.

+

+

Checks whether the parameter is an instance of Float or not.

+

Syntax ``` @@ -917,7 +995,7 @@ insert into barStream; arg - The parameter to be checked. +

The parameter to be checked.

INT
LONG
DOUBLE
FLOAT
STRING
BOOL
OBJECT No @@ -932,18 +1010,22 @@ from fooStream select instanceOfFloat(value) as state insert into barStream; ``` -

This will return true if the value field format is float ex : 56.45f.

- +

+

This will return true if the value field format is float ex : 56.45f.

+

EXAMPLE 2 ``` from fooStream select instanceOfFloat(switchState) as state insert into barStream; ``` -

if the switchState = true then this will returns false as the value is an instance of the boolean not a float.

- +

+

if the switchState = true then this will returns false as the value is an instance of the boolean not a float.

+

### instanceOfInteger *(Function)* -

Checks whether the parameter is an instance of Integer or not.

+

+

Checks whether the parameter is an instance of Integer or not.

+

Syntax ``` @@ -962,7 +1044,7 @@ insert into barStream; arg - The parameter to be checked. +

The parameter to be checked.

INT
LONG
DOUBLE
FLOAT
STRING
BOOL
OBJECT No @@ -977,18 +1059,22 @@ from fooStream select instanceOfInteger(value) as state insert into barStream; ``` -

This will return true if the value field format is integer.

- +

+

This will return true if the value field format is integer.

+

EXAMPLE 2 ``` from fooStream select instanceOfInteger(switchState) as state insert into barStream; ``` -

if the switchState = true then this will returns false as the value is an instance of the boolean not a long.

- +

+

if the switchState = true then this will returns false as the value is an instance of the boolean not a long.

+

### instanceOfLong *(Function)* -

Checks whether the parameter is an instance of Long or not.

+

+

Checks whether the parameter is an instance of Long or not.

+

Syntax ``` @@ -1007,7 +1093,7 @@ insert into barStream; arg - The parameter to be checked. +

The parameter to be checked.

INT
LONG
DOUBLE
FLOAT
STRING
BOOL
OBJECT No @@ -1022,18 +1108,22 @@ from fooStream select instanceOfLong(value) as state insert into barStream; ``` -

This will return true if the value field format is long ex : 56456l.

- +

+

This will return true if the value field format is long ex : 56456l.

+

EXAMPLE 2 ``` from fooStream select instanceOfLong(switchState) as state insert into barStream; ``` -

if the switchState = true then this will returns false as the value is an instance of the boolean not a long.

- +

+

if the switchState = true then this will returns false as the value is an instance of the boolean not a long.

+

### instanceOfString *(Function)* -

Checks whether the parameter is an instance of String or not.

+

+

Checks whether the parameter is an instance of String or not.

+

Syntax ``` @@ -1052,7 +1142,7 @@ insert into barStream; arg - The parameter to be checked. +

The parameter to be checked.

INT
LONG
DOUBLE
FLOAT
STRING
BOOL
OBJECT No @@ -1067,18 +1157,22 @@ from fooStream select instanceOfString(value) as state insert into barStream; ``` -

This will return true if the value field format is string ex : 'test'.

- +

+

This will return true if the value field format is string ex : 'test'.

+

EXAMPLE 2 ``` from fooStream select instanceOfString(switchState) as state insert into barStream; ``` -

if the switchState = true then this will returns false as the value is an instance of the boolean not a string.

- +

+

if the switchState = true then this will returns false as the value is an instance of the boolean not a string.

+

### maximum *(Function)* -

Returns the maximum value of the input parameters.

+

+

Returns the maximum value of the input parameters.

+

Syntax ``` @@ -1097,7 +1191,7 @@ insert into barStream; arg - This function accepts one or more parameters. They can belong to any one of the available types. All the specified parameters should be of the same type. +

This function accepts one or more parameters. They can belong to any one of the available types. All the specified parameters should be of the same type.

INT
LONG
DOUBLE
FLOAT No @@ -1112,10 +1206,13 @@ insert into barStream; select maximum(price1, price2, price3) as max insert into outputStream; ``` -

This will returns the maximum value of the input parameters price1, price2, price3.

- +

+

This will returns the maximum value of the input parameters price1, price2, price3.

+

### minimum *(Function)* -

Returns the minimum value of the input parameters.

+

+

Returns the minimum value of the input parameters.

+

Syntax ``` @@ -1134,7 +1231,7 @@ insert into outputStream; arg - This function accepts one or more parameters. They can belong to any one of the available types. All the specified parameters should be of the same type. +

This function accepts one or more parameters. They can belong to any one of the available types. All the specified parameters should be of the same type.

INT
LONG
DOUBLE
FLOAT No @@ -1149,10 +1246,13 @@ insert into outputStream; select maximum(price1, price2, price3) as max insert into outputStream; ``` -

This will returns the minimum value of the input parameters price1, price2, price3.

- +

+

This will returns the minimum value of the input parameters price1, price2, price3.

+

### sizeOfSet *(Function)* -

Returns the size of an object of type java.util.Set.

+

+

Returns the size of an object of type java.util.Set.

+

Syntax ``` @@ -1171,7 +1271,7 @@ insert into outputStream; set - The set object. This parameter should be of type java.util.Set. A set object may be created by the 'set' attribute aggregator in Siddhi. +

The set object. This parameter should be of type java.util.Set. A set object may be created by the 'set' attribute aggregator in Siddhi.

OBJECT No @@ -1194,10 +1294,13 @@ from distinctStockStream select sizeOfSet(distinctSymbols) sizeOfSymbolSet insert into sizeStream; ``` -

The sizeStream stream will output the number of distinct stock symbols received during a sliding window of 10 seconds.

- +

+

The sizeStream stream will output the number of distinct stock symbols received during a sliding window of 10 seconds.

+

### pol2Cart *(Stream Function)* -

The pol2Cart function calculating the cartesian coordinates x & y for the given theta, rho coordinates and adding them as new attributes to the existing events.

+

+

The pol2Cart function calculating the cartesian coordinates x & y for the given theta, rho coordinates and adding them as new attributes to the existing events.

+

Syntax ``` @@ -1217,7 +1320,7 @@ pol2Cart( theta, rho, z) theta - The theta value of the coordinates. +

The theta value of the coordinates.

DOUBLE No @@ -1225,7 +1328,7 @@ pol2Cart( theta, rho, z) rho - The rho value of the coordinates. +

The rho value of the coordinates.

DOUBLE No @@ -1233,7 +1336,7 @@ pol2Cart( theta, rho, z) z - z value of the cartesian coordinates. +

z value of the cartesian coordinates.

If z value is not given, drop the third parameter of the output. DOUBLE Yes @@ -1248,18 +1351,22 @@ from PolarStream#pol2Cart(theta, rho) select x, y insert into outputStream ; ``` -

This will return cartesian coordinates (4.99953024681082, 0.06853693328228748) for theta: 0.7854 and rho: 5.

- +

+

This will return cartesian coordinates (4.99953024681082, 0.06853693328228748) for theta: 0.7854 and rho: 5.

+

EXAMPLE 2 ``` from PolarStream#pol2Cart(theta, rho, 3.4) select x, y, z insert into outputStream ; ``` -

This will return cartesian coordinates (4.99953024681082, 0.06853693328228748, 3.4)for theta: 0.7854 and rho: 5 and z: 3.4.

- +

+

This will return cartesian coordinates (4.99953024681082, 0.06853693328228748, 3.4)for theta: 0.7854 and rho: 5 and z: 3.4.

+

### log *(Stream Processor)* -

The logger logs the message on the given priority with or without processed event.

+

+

The logger logs the message on the given priority with or without processed event.

+

Syntax ``` @@ -1283,7 +1390,7 @@ log( priority, log.message, is.event.logged) priority - The priority/type of this log message (INFO, DEBUG, WARN, FATAL, ERROR, OFF, TRACE). +

The priority/type of this log message (INFO, DEBUG, WARN, FATAL, ERROR, OFF, TRACE).

INFO STRING Yes @@ -1291,7 +1398,7 @@ log( priority, log.message, is.event.logged) log.message - This message will be logged. +

This message will be logged.

: STRING Yes @@ -1299,7 +1406,7 @@ log( priority, log.message, is.event.logged) is.event.logged - To log the processed event. +

To log the processed event.

true BOOL Yes @@ -1314,50 +1421,58 @@ from fooStream#log("INFO", "Sample Event :", true) select * insert into barStream; ``` -

This will log as INFO with the message "Sample Event :" + fooStream:events.

- +

+

This will log as INFO with the message "Sample Event :" + fooStream:events.

+

EXAMPLE 2 ``` from fooStream#log("Sample Event :", true) select * insert into barStream; ``` -

This will logs with default log level as INFO.

- +

+

This will logs with default log level as INFO.

+

EXAMPLE 3 ``` from fooStream#log("Sample Event :", fasle) select * insert into barStream; ``` -

This will only log message.

- +

+

This will only log message.

+

EXAMPLE 4 ``` from fooStream#log(true) select * insert into barStream; ``` -

This will only log fooStream:events.

- +

+

This will only log fooStream:events.

+

EXAMPLE 5 ``` from fooStream#log() select * insert into barStream; ``` -

This will only log fooStream:events.

- +

+

This will only log fooStream:events.

+

EXAMPLE 6 ``` from fooStream#log("Sample Event :") select * insert into barStream; ``` -

This will log message and fooStream:events.

- +

+

This will log message and fooStream:events.

+

### batch *(Window)* -

A window that holds an incoming events batch. When a new set of events arrives, the previously arrived old events will be expired. Batch window can be used to aggregate events that comes in batches. If it has the parameter length specified, then batch window process the batch as several chunks.

+

+

A window that holds an incoming events batch. When a new set of events arrives, the previously arrived old events will be expired. Batch window can be used to aggregate events that comes in batches. If it has the parameter length specified, then batch window process the batch as several chunks.

+

Syntax ``` @@ -1377,7 +1492,7 @@ batch( window.length) window.length - The length of a chunk +

The length of a chunk

If length value was not given it assign 0 as length and process the whole batch as once INT Yes @@ -1395,10 +1510,13 @@ select price, str:groupConcat(itemId) as itemIds group by price insert into outputStream; ``` -

This will output comma separated items IDs that have the same price for each incoming batch of events.

- +

+

This will output comma separated items IDs that have the same price for each incoming batch of events.

+

### cron *(Window)* -

This window outputs the arriving events as and when they arrive, and resets (expires) the window periodically based on the given cron expression.

+

+

This window outputs the arriving events as and when they arrive, and resets (expires) the window periodically based on the given cron expression.

+

Syntax ``` @@ -1417,7 +1535,7 @@ cron( cron.expression) cron.expression - The cron expression that resets the window. +

The cron expression that resets the window.

STRING No @@ -1435,8 +1553,9 @@ from InputEventStream#cron('*/5 * * * * ?') select symbol, sum(price) as totalPrice insert into OutputStream; ``` -

This let the totalPrice to gradually increase and resets to zero as a batch every 5 seconds.

- +

+

This let the totalPrice to gradually increase and resets to zero as a batch every 5 seconds.

+

EXAMPLE 2 ``` define stream StockEventStream (symbol string, price float, volume int) @@ -1451,10 +1570,13 @@ from StockEventWindow select symbol, sum(price) as totalPrice insert into OutputStream ; ``` -

The defined window will let the totalPrice to gradually increase and resets to zero as a batch every 5 seconds.

- +

+

The defined window will let the totalPrice to gradually increase and resets to zero as a batch every 5 seconds.

+

### delay *(Window)* -

A delay window holds events for a specific time period that is regarded as a delay period before processing them.

+

+

A delay window holds events for a specific time period that is regarded as a delay period before processing them.

+

Syntax ``` @@ -1473,7 +1595,7 @@ delay( window.delay) window.delay - The time period (specified in sec, min, ms) for which the window should delay the events. +

The time period (specified in sec, min, ms) for which the window should delay the events.

INT
LONG
TIME No @@ -1500,10 +1622,13 @@ on delayWindow.symbol == DeliveryStream.symbol select delayWindow.symbol insert into OutputStream; ``` -

In this example, purchase events that arrive in the 'PurchaseStream' stream are directed to a delay window. At any given time, this delay window holds purchase events that have arrived within the last hour. These purchase events in the window are matched by the 'symbol' attribute, with delivery events that arrive in the 'DeliveryStream' stream. This monitors whether the delivery of products is done with a minimum delay of one hour after the purchase.

- +

+

In this example, purchase events that arrive in the 'PurchaseStream' stream are directed to a delay window. At any given time, this delay window holds purchase events that have arrived within the last hour. These purchase events in the window are matched by the 'symbol' attribute, with delivery events that arrive in the 'DeliveryStream' stream. This monitors whether the delivery of products is done with a minimum delay of one hour after the purchase.

+

### externalTime *(Window)* -

A sliding time window based on external time. It holds events that arrived during the last windowTime period from the external timestamp, and gets updated on every monotonically increasing timestamp.

+

+

A sliding time window based on external time. It holds events that arrived during the last windowTime period from the external timestamp, and gets updated on every monotonically increasing timestamp.

+

Syntax ``` @@ -1522,7 +1647,7 @@ externalTime( timestamp, window.time) timestamp - The time which the window determines as current time and will act upon. The value of this parameter should be monotonically increasing. +

The time which the window determines as current time and will act upon. The value of this parameter should be monotonically increasing.

LONG No @@ -1530,7 +1655,7 @@ externalTime( timestamp, window.time) window.time - The sliding time period for which the window should hold events. +

The sliding time period for which the window should hold events.

INT
LONG
TIME No @@ -1552,10 +1677,13 @@ from cseEventWindow select symbol, sum(price) as price insert expired events into outputStream ; ``` -

processing events arrived within the last 20 seconds from the eventTime and output expired events.

- +

+

processing events arrived within the last 20 seconds from the eventTime and output expired events.

+

### externalTimeBatch *(Window)* -

A batch (tumbling) time window based on external time, that holds events arrived during windowTime periods, and gets updated for every windowTime.

+

+

A batch (tumbling) time window based on external time, that holds events arrived during windowTime periods, and gets updated for every windowTime.

+

Syntax ``` @@ -1577,7 +1705,7 @@ externalTimeBatch( timestamp, window.time, timestamp - The time which the window determines as current time and will act upon. The value of this parameter should be monotonically increasing. +

The time which the window determines as current time and will act upon. The value of this parameter should be monotonically increasing.

LONG No @@ -1585,7 +1713,7 @@ externalTimeBatch( timestamp, window.time, window.time - The batch time period for which the window should hold events. +

The batch time period for which the window should hold events.

INT
LONG
TIME No @@ -1593,7 +1721,7 @@ externalTimeBatch( timestamp, window.time, start.time - User defined start time. This could either be a constant (of type int, long or time) or an attribute of the corresponding stream (of type long). If an attribute is provided, initial value of attribute would be considered as startTime. +

User defined start time. This could either be a constant (of type int, long or time) or an attribute of the corresponding stream (of type long). If an attribute is provided, initial value of attribute would be considered as startTime.

Timestamp of first event INT
LONG
TIME Yes @@ -1601,7 +1729,7 @@ externalTimeBatch( timestamp, window.time, timeout - Time to wait for arrival of new event, before flushing and giving output for events belonging to a specific batch. +

Time to wait for arrival of new event, before flushing and giving output for events belonging to a specific batch.

System waits till an event from next batch arrives to flush current batch INT
LONG
TIME Yes @@ -1609,7 +1737,7 @@ externalTimeBatch( timestamp, window.time, replace.with.batchtime - This indicates to replace the expired event timeStamp as the batch end timeStamp +

This indicates to replace the expired event timeStamp as the batch end timeStamp

System waits till an event from next batch arrives to flush current batch BOOL Yes @@ -1629,23 +1757,28 @@ from cseEventWindow select symbol, sum(price) as price insert expired events into outputStream ; ``` -

This will processing events that arrive every 1 seconds from the eventTime.

- +

+

This will processing events that arrive every 1 seconds from the eventTime.

+

EXAMPLE 2 ``` define window cseEventWindow (symbol string, price float, volume int) externalTimeBatch(eventTime, 20 sec, 0) output expired events; ``` -

This will processing events that arrive every 1 seconds from the eventTime. Starts on 0th millisecond of an hour.

- +

+

This will processing events that arrive every 1 seconds from the eventTime. Starts on 0th millisecond of an hour.

+

EXAMPLE 3 ``` define window cseEventWindow (symbol string, price float, volume int) externalTimeBatch(eventTime, 2 sec, eventTimestamp, 100) output expired events; ``` -

This will processing events that arrive every 2 seconds from the eventTim. Considers the first event's eventTimestamp value as startTime. Waits 100 milliseconds for the arrival of a new event before flushing current batch.

- +

+

This will processing events that arrive every 2 seconds from the eventTim. Considers the first event's eventTimestamp value as startTime. Waits 100 milliseconds for the arrival of a new event before flushing current batch.

+

### frequent *(Window)*

Deprecated

-

This window returns the latest events with the most frequently occurred value for a given attribute(s). Frequency calculation for this window processor is based on Misra-Gries counting algorithm.

+

+

This window returns the latest events with the most frequently occurred value for a given attribute(s). Frequency calculation for this window processor is based on Misra-Gries counting algorithm.

+

Syntax ``` @@ -1665,7 +1798,7 @@ frequent( event.count, attribute) event.count - The number of most frequent events to be emitted to the stream. +

The number of most frequent events to be emitted to the stream.

INT No @@ -1673,7 +1806,7 @@ frequent( event.count, attribute) attribute - The attributes to group the events. If no attributes are given, the concatenation of all the attributes of the event is considered. +

The attributes to group the events. If no attributes are given, the concatenation of all the attributes of the event is considered.

The concatenation of all the attributes of the event is considered. STRING Yes @@ -1689,8 +1822,9 @@ from purchase[price >= 30]#window.frequent(2) select cardNo, price insert all events into PotentialFraud; ``` -

This will returns the 2 most frequent events.

- +

+

This will returns the 2 most frequent events.

+

EXAMPLE 2 ``` @info(name = 'query1') @@ -1698,10 +1832,13 @@ from purchase[price >= 30]#window.frequent(2, cardNo) select cardNo, price insert all events into PotentialFraud; ``` -

This will returns the 2 latest events with the most frequently appeared card numbers.

- +

+

This will returns the 2 latest events with the most frequently appeared card numbers.

+

### length *(Window)* -

A sliding length window that holds the last 'window.length' events at a given time, and gets updated for each arrival and expiry.

+

+

A sliding length window that holds the last 'window.length' events at a given time, and gets updated for each arrival and expiry.

+

Syntax ``` @@ -1720,7 +1857,7 @@ length( window.length) window.length - The number of events that should be included in a sliding length window. +

The number of events that should be included in a sliding length window.

INT No @@ -1742,10 +1879,13 @@ from StockEventWindow select symbol, sum(price) as price insert all events into outputStream ; ``` -

This will process last 10 events in a sliding manner.

- +

+

This will process last 10 events in a sliding manner.

+

### lengthBatch *(Window)* -

A batch (tumbling) length window that holds and process a number of events as specified in the window.length.

+

+

A batch (tumbling) length window that holds and process a number of events as specified in the window.length.

+

Syntax ``` @@ -1765,7 +1905,7 @@ lengthBatch( window.length, stream.current.event) window.length - The number of events the window should tumble. +

The number of events the window should tumble.

INT No @@ -1773,7 +1913,7 @@ lengthBatch( window.length, stream.current.event) stream.current.event - Let the window stream the current events out as and when they arrive to the window while expiring them in batches. +

Let the window stream the current events out as and when they arrive to the window while expiring them in batches.

false BOOL Yes @@ -1791,8 +1931,9 @@ from InputEventStream#lengthBatch(10) select symbol, sum(price) as price insert into OutputStream; ``` -

This collect and process 10 events as a batch and output them.

- +

+

This collect and process 10 events as a batch and output them.

+

EXAMPLE 2 ``` define stream InputEventStream (symbol string, price float, volume int); @@ -1802,8 +1943,9 @@ from InputEventStream#lengthBatch(10, true) select symbol, sum(price) as sumPrice insert into OutputStream; ``` -

This window sends the arriving events directly to the output letting the sumPrice to increase gradually, after every 10 events it clears the window as a batch and resets the sumPrice to zero.

- +

+

This window sends the arriving events directly to the output letting the sumPrice to increase gradually, after every 10 events it clears the window as a batch and resets the sumPrice to zero.

+

EXAMPLE 3 ``` define stream InputEventStream (symbol string, price float, volume int); @@ -1818,11 +1960,14 @@ from StockEventWindow select symbol, sum(price) as price insert all events into OutputStream ; ``` -

This uses an defined window to process 10 events as a batch and output all events.

- +

+

This uses an defined window to process 10 events as a batch and output all events.

+

### lossyFrequent *(Window)*

Deprecated

-

This window identifies and returns all the events of which the current frequency exceeds the value specified for the supportThreshold parameter.

+

+

This window identifies and returns all the events of which the current frequency exceeds the value specified for the supportThreshold parameter.

+

Syntax ``` @@ -1843,7 +1988,7 @@ lossyFrequent( support.threshold, error.bound, attribu support.threshold - The support threshold value. +

The support threshold value.

DOUBLE No @@ -1851,7 +1996,7 @@ lossyFrequent( support.threshold, error.bound, attribu error.bound - The error bound value. +

The error bound value.

`support.threshold`/10 DOUBLE Yes @@ -1859,7 +2004,7 @@ lossyFrequent( support.threshold, error.bound, attribu attribute - The attributes to group the events. If no attributes are given, the concatenation of all the attributes of the event is considered. +

The attributes to group the events. If no attributes are given, the concatenation of all the attributes of the event is considered.

The concatenation of all the attributes of the event is considered. STRING Yes @@ -1880,8 +2025,9 @@ from purchaseWindow select cardNo, price insert all events into PotentialFraud; ``` -

lossyFrequent(0.1, 0.01) returns all the events of which the current frequency exceeds 0.1, with an error bound of 0.01.

- +

+

lossyFrequent(0.1, 0.01) returns all the events of which the current frequency exceeds 0.1, with an error bound of 0.01.

+

EXAMPLE 2 ``` define stream purchase (cardNo string, price float); @@ -1894,10 +2040,13 @@ from purchaseWindow select cardNo, price insert all events into PotentialFraud; ``` -

lossyFrequent(0.3, 0.05, cardNo) returns all the events of which the cardNo attributes frequency exceeds 0.3, with an error bound of 0.05.

- +

+

lossyFrequent(0.3, 0.05, cardNo) returns all the events of which the cardNo attributes frequency exceeds 0.3, with an error bound of 0.05.

+

### session *(Window)* -

This is a session window that holds events that belong to a specific session. The events that belong to a specific session are identified by a grouping attribute (i.e., a session key). A session gap period is specified to determine the time period after which the session is considered to be expired. A new event that arrives with a specific value for the session key is matched with the session window with the same session key.
 There can be out of order and late arrival of events, these events can arrive after the session is expired, to include those events to the matching session key specify a latency time period that is less than the session gap period.To have aggregate functions with session windows, the events need to be grouped by the session key via a 'group by' clause.

+

+

This is a session window that holds events that belong to a specific session. The events that belong to a specific session are identified by a grouping attribute (i.e., a session key). A session gap period is specified to determine the time period after which the session is considered to be expired. A new event that arrives with a specific value for the session key is matched with the session window with the same session key.
 There can be out of order and late arrival of events, these events can arrive after the session is expired, to include those events to the matching session key specify a latency time period that is less than the session gap period.To have aggregate functions with session windows, the events need to be grouped by the session key via a 'group by' clause.

+

Syntax ``` @@ -1918,7 +2067,7 @@ session( window.session, window.key, win window.session - The time period for which the session considered is valid. This is specified in seconds, minutes, or milliseconds (i.e., 'min', 'sec', or 'ms'. +

The time period for which the session considered is valid. This is specified in seconds, minutes, or milliseconds (i.e., 'min', 'sec', or 'ms'.

INT
LONG
TIME No @@ -1926,7 +2075,7 @@ session( window.session, window.key, win window.key - The grouping attribute for events. +

The grouping attribute for events.

default-key STRING Yes @@ -1934,7 +2083,7 @@ session( window.session, window.key, win window.allowed.latency - This specifies the time period for which the session window is valid after the expiration of the session. The time period specified here should be less than the session time gap (which is specified via the 'window.session' parameter). +

This specifies the time period for which the session window is valid after the expiration of the session. The time period specified here should be less than the session time gap (which is specified via the 'window.session' parameter).

0 INT
LONG
TIME Yes @@ -1952,10 +2101,13 @@ from PurchaseEventStream#window.session(5 sec, user, 2 sec) select * insert all events into OutputStream; ``` -

This query processes events that arrive at the PurchaseEvent input stream. The 'user' attribute is the session key, and the session gap is 5 seconds. '2 sec' is specified as the allowed latency. Therefore, events with the matching user name that arrive 2 seconds after the expiration of the session are also considered when performing aggregations for the session identified by the given user name.

- +

+

This query processes events that arrive at the PurchaseEvent input stream. The 'user' attribute is the session key, and the session gap is 5 seconds. '2 sec' is specified as the allowed latency. Therefore, events with the matching user name that arrive 2 seconds after the expiration of the session are also considered when performing aggregations for the session identified by the given user name.

+

### sort *(Window)* -

This window holds a batch of events that equal the number specified as the windowLength and sorts them in the given order.

+

+

This window holds a batch of events that equal the number specified as the windowLength and sorts them in the given order.

+

Syntax ``` @@ -1976,7 +2128,7 @@ sort( window.length, attribute, window.length - The size of the window length. +

The size of the window length.

INT No @@ -1984,7 +2136,7 @@ sort( window.length, attribute, attribute - The attribute that should be checked for the order. +

The attribute that should be checked for the order.

The concatenation of all the attributes of the event is considered. STRING
DOUBLE
INT
LONG
FLOAT
LONG No @@ -1992,7 +2144,7 @@ sort( window.length, attribute, order - The order define as "asc" or "desc". +

The order define as "asc" or "desc".

asc STRING Yes @@ -2013,10 +2165,13 @@ from cseEventWindow select volume insert all events into outputStream ; ``` -

sort(5, price, 'asc') keeps the events sorted by price in the ascending order. Therefore, at any given time, the window contains the 5 lowest prices.

- +

+

sort(5, price, 'asc') keeps the events sorted by price in the ascending order. Therefore, at any given time, the window contains the 5 lowest prices.

+

### time *(Window)* -

A sliding time window that holds events that arrived during the last windowTime period at a given time, and gets updated for each event arrival and expiry.

+

+

A sliding time window that holds events that arrived during the last windowTime period at a given time, and gets updated for each event arrival and expiry.

+

Syntax ``` @@ -2035,7 +2190,7 @@ time( window.time) window.time - The sliding time period for which the window should hold events. +

The sliding time period for which the window should hold events.

INT
LONG
TIME No @@ -2055,10 +2210,13 @@ from cseEventWindow select symbol, sum(price) as price insert all events into outputStream ; ``` -

This will processing events that arrived within the last 20 milliseconds.

- +

+

This will processing events that arrived within the last 20 milliseconds.

+

### timeBatch *(Window)* -

A batch (tumbling) time window that holds and process events that arrive during 'window.time' period as a batch.

+

+

A batch (tumbling) time window that holds and process events that arrive during 'window.time' period as a batch.

+

Syntax ``` @@ -2080,7 +2238,7 @@ timeBatch( window.time, start.time, stream.curr window.time - The batch time period in which the window process the events. +

The batch time period in which the window process the events.

INT
LONG
TIME No @@ -2088,7 +2246,7 @@ timeBatch( window.time, start.time, stream.curr start.time - This specifies an offset in milliseconds in order to start the window at a time different to the standard time. +

This specifies an offset in milliseconds in order to start the window at a time different to the standard time.

Timestamp of first event INT
LONG Yes @@ -2096,7 +2254,7 @@ timeBatch( window.time, start.time, stream.curr stream.current.event - Let the window stream the current events out as and when they arrive to the window while expiring them in batches. +

Let the window stream the current events out as and when they arrive to the window while expiring them in batches.

false BOOL Yes @@ -2114,8 +2272,9 @@ from InputEventStream#timeBatch(20 sec) select symbol, sum(price) as price insert into OutputStream; ``` -

This collect and process incoming events as a batch every 20 seconds and output them.

- +

+

This collect and process incoming events as a batch every 20 seconds and output them.

+

EXAMPLE 2 ``` define stream InputEventStream (symbol string, price float, volume int); @@ -2125,8 +2284,9 @@ from InputEventStream#timeBatch(20 sec, true) select symbol, sum(price) as sumPrice insert into OutputStream; ``` -

This window sends the arriving events directly to the output letting the sumPrice to increase gradually and on every 20 second interval it clears the window as a batch resetting the sumPrice to zero.

- +

+

This window sends the arriving events directly to the output letting the sumPrice to increase gradually and on every 20 second interval it clears the window as a batch resetting the sumPrice to zero.

+

EXAMPLE 3 ``` define stream InputEventStream (symbol string, price float, volume int); @@ -2141,10 +2301,13 @@ from StockEventWindow select symbol, sum(price) as price insert all events into OutputStream ; ``` -

This uses an defined window to process events arrived every 20 seconds as a batch and output all events.

- +

+

This uses an defined window to process events arrived every 20 seconds as a batch and output all events.

+

### timeLength *(Window)* -

A sliding time window that, at a given time holds the last window.length events that arrived during last window.time period, and gets updated for every event arrival and expiry.

+

+

A sliding time window that, at a given time holds the last window.length events that arrived during last window.time period, and gets updated for every event arrival and expiry.

+

Syntax ``` @@ -2163,7 +2326,7 @@ timeLength( window.time, window.length) window.time - The sliding time period for which the window should hold events. +

The sliding time period for which the window should hold events.

INT
LONG
TIME No @@ -2171,7 +2334,7 @@ timeLength( window.time, window.length) window.length - The number of events that should be be included in a sliding length window.. +

The number of events that should be be included in a sliding length window..

INT No @@ -2191,12 +2354,15 @@ insert into cseEventWindow; from cseEventWindow select symbol, price, volume insert all events into outputStream; ``` -

window.timeLength(2 sec, 10) holds the last 10 events that arrived during last 2 seconds and gets updated for every event arrival and expiry.

- +

+

window.timeLength(2 sec, 10) holds the last 10 events that arrived during last 2 seconds and gets updated for every event arrival and expiry.

+

## Sink ### inMemory *(Sink)* -

In-memory transport that can communicate with other in-memory transports within the same JVM, itis assumed that the publisher and subscriber of a topic uses same event schema (stream definition).

+

+

In-memory transport that can communicate with other in-memory transports within the same JVM, itis assumed that the publisher and subscriber of a topic uses same event schema (stream definition).

+

Syntax ``` @@ -2215,7 +2381,7 @@ insert all events into outputStream; topic - Event will be delivered to allthe subscribers of the same topic +

Event will be delivered to allthe subscribers of the same topic

STRING No @@ -2229,10 +2395,13 @@ insert all events into outputStream; @sink(type='inMemory', @map(type='passThrough')) define stream BarStream (symbol string, price float, volume long) ``` -

In this example BarStream uses inMemory transport which emit the Siddhi events internally without using external transport and transformation.

- +

+

In this example BarStream uses inMemory transport which emit the Siddhi events internally without using external transport and transformation.

+

### log *(Sink)* -

This is a sink that can be used as a logger. This will log the output events in the output stream with user specified priority and a prefix

+

+

This is a sink that can be used as a logger. This will log the output events in the output stream with user specified priority and a prefix

+

Syntax ``` @@ -2251,7 +2420,7 @@ define stream BarStream (symbol string, price float, volume long) priority - This will set the logger priority i.e log level. Accepted values are INFO, DEBUG, WARN, FATAL, ERROR, OFF, TRACE +

This will set the logger priority i.e log level. Accepted values are INFO, DEBUG, WARN, FATAL, ERROR, OFF, TRACE

INFO STRING Yes @@ -2259,7 +2428,7 @@ define stream BarStream (symbol string, price float, volume long) prefix - This will be the prefix to the output message. If the output stream has event [2,4] and the prefix is given as "Hello" then the log will show "Hello : [2,4]" +

This will be the prefix to the output message. If the output stream has event [2,4] and the prefix is given as "Hello" then the log will show "Hello : [2,4]"

default prefix will be : STRING Yes @@ -2273,33 +2442,39 @@ define stream BarStream (symbol string, price float, volume long) @sink(type='log', prefix='My Log', priority='DEBUG') define stream BarStream (symbol string, price float, volume long) ``` -

In this example BarStream uses log sink and the prefix is given as My Log. Also the priority is set to DEBUG.

- +

+

In this example BarStream uses log sink and the prefix is given as My Log. Also the priority is set to DEBUG.

+

EXAMPLE 2 ``` @sink(type='log', priority='DEBUG') define stream BarStream (symbol string, price float, volume long) ``` -

In this example BarStream uses log sink and the priority is set to DEBUG. User has not specified prefix so the default prefix will be in the form <Siddhi App Name> : <Stream Name>

- +

+

In this example BarStream uses log sink and the priority is set to DEBUG. User has not specified prefix so the default prefix will be in the form <Siddhi App Name> : <Stream Name>

+

EXAMPLE 3 ``` @sink(type='log', prefix='My Log') define stream BarStream (symbol string, price float, volume long) ``` -

In this example BarStream uses log sink and the prefix is given as My Log. User has not given a priority so it will be set to default INFO.

- +

+

In this example BarStream uses log sink and the prefix is given as My Log. User has not given a priority so it will be set to default INFO.

+

EXAMPLE 4 ``` @sink(type='log') define stream BarStream (symbol string, price float, volume long) ``` -

In this example BarStream uses log sink. The user has not given prefix or priority so they will be set to their default values.

- +

+

In this example BarStream uses log sink. The user has not given prefix or priority so they will be set to their default values.

+

## Sinkmapper ### passThrough *(Sink Mapper)* -

Pass-through mapper passed events (Event[]) through without any mapping or modifications.

+

+

Pass-through mapper passed events (Event[]) through without any mapping or modifications.

+

Syntax ``` @@ -2312,12 +2487,15 @@ define stream BarStream (symbol string, price float, volume long) @sink(type='inMemory', @map(type='passThrough')) define stream BarStream (symbol string, price float, volume long); ``` -

In the following example BarStream uses passThrough outputmapper which emit Siddhi event directly without any transformation into sink.

- +

+

In the following example BarStream uses passThrough outputmapper which emit Siddhi event directly without any transformation into sink.

+

## Source ### inMemory *(Source)* -

In-memory source that can communicate with other in-memory sinks within the same JVM, it is assumed that the publisher and subscriber of a topic uses same event schema (stream definition).

+

+

In-memory source that can communicate with other in-memory sinks within the same JVM, it is assumed that the publisher and subscriber of a topic uses same event schema (stream definition).

+

Syntax ``` @@ -2336,7 +2514,7 @@ define stream BarStream (symbol string, price float, volume long); topic - Subscribes to sent on the given topic. +

Subscribes to sent on the given topic.

STRING No @@ -2350,12 +2528,15 @@ define stream BarStream (symbol string, price float, volume long); @source(type='inMemory', @map(type='passThrough')) define stream BarStream (symbol string, price float, volume long) ``` -

In this example BarStream uses inMemory transport which passes the received event internally without using external transport.

- +

+

In this example BarStream uses inMemory transport which passes the received event internally without using external transport.

+

## Sourcemapper ### passThrough *(Source Mapper)* -

Pass-through mapper passed events (Event[]) through without any mapping or modifications.

+

+

Pass-through mapper passed events (Event[]) through without any mapping or modifications.

+

Syntax ``` @@ -2368,5 +2549,6 @@ define stream BarStream (symbol string, price float, volume long) @source(type='tcp', @map(type='passThrough')) define stream BarStream (symbol string, price float, volume long); ``` -

In this example BarStream uses passThrough inputmapper which passes the received Siddhi event directly without any transformation into source.

- +

+

In this example BarStream uses passThrough inputmapper which passes the received Siddhi event directly without any transformation into source.

+

diff --git a/docs/index.md b/docs/index.md index 1fe5aca0a8..0edcb965e6 100755 --- a/docs/index.md +++ b/docs/index.md @@ -40,7 +40,7 @@ For more information on using Siddhi refer 5.1.1. +Latest API Docs is 5.1.2. ## Support and Contribution diff --git a/mkdocs.yml b/mkdocs.yml index e96074acf6..ab9e9bd7eb 100755 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -34,6 +34,7 @@ pages: - Introduction: index.md - API Docs: - latest: api/latest.md + - 5.1.2: api/5.1.2.md - 5.1.1: api/5.1.1.md - 5.1.0: api/5.1.0.md - 5.0.2: api/5.0.2.md