Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

To add a Siddhi component to the Siddhi application that you are creating/editing in the design view, click on the relevant icon in the left pane, and then drag and drop it to the grid as demonstrated in the example below.

Image RemovedImage Added

Anchor
Settings
Settings
Once you add a Siddhi component, you can configure it as required. To configure a Siddhi component, click the settings icon on the component. This opens a form with parameters related to the relevant component.

Image Added

The following is the complete list of Siddhi components that you can add to the grid of the design view when you create a Siddhi application.

...

Icon

DescriptionA stream represents a logical series of events ordered in time. For a detailed description of streams, see Siddhi Query Guide - Stream.
Form

Once you add a stream component to a Siddhi application in the design view, the Define Stream form appears below the grid. To configure the stream, following information can be specified in this formclick the settings icon on the stream component you added to the grid. Then enter values as follows:

Stream Name : A unique name for the stream. This should be specified in title caps, and without spaces (e.g., ProductionDataStream).

Attributes: Attributes of streams are specified as name and type pairs in the Attributes table.

Example

Image RemovedImage Added

The details entered in the above form creates a stream with the following configuration as follows:

Code Block
languagesql
define stream SweetProductionStream (amount double, name string);
Source
  • Sources
  • Projection queries
  • Filter queries
  • Window queries
  • Join queries
Target
  • Sinks
  • Projection queries
  • Filter queries
  • Window queries
  • Join queries

...

Icon

DescriptionA source receives events in the specified transport and in the specified format. For more information, see Siddhi Query Guide - Source.
Form

Once you add a To configure the source, click the settings icon on the source component to a Siddhi application in the design view, the Define Source form appears below you added to the grid. To configure the event source, following information can be specified in this form:This opens a form where you can enter the following information:

Info

To access the form in which you can configure a source, you must first connect the source as the source (input) object to a stream component.


Table

define table ShipmentDetails
  • Source Type: This specifies the transport type via which the events are received. The value should be entered in lower case (e.g., tcp). The other parameters displayed for the source depends on the source type selected.
  • Options: To add this section, you need to click Properties next to Source and select the Options check box. This section allows you to add properties you want to configure for the selected transport. You can click + Option to add a new option. The value must be entered in the <PROPERTY_NAME>=<'PROPERTY_VALUE'> format (e.g., context='SweetProductionData').

  • Properties: To add this section, you need to click Properties next to Source and select the Map check box.This section specifies the format in which the events are received via the source, and allows you to define the mapping so that incoming events can be converted to Siddhi events. The event format is specified in the Name field of the Type section in lower case (e.g., binary). To configure the mapping based on the mapper type you selected, you can click Properties next to Map and select the Type check box and/or the Attribute Mapping check box.
Icon

Image Removed

DescriptionA table is a stored version of an stream or a table of events. For more information, see Siddhi Query Guide - Table.
Form

Once you add a table component to a Siddhi application in the design view, the Table Configuration form appears below the grid. To configure the table, following information can be specified in this form:

Name : This field specifies unique name for the table. This should be specified in title caps, and without spaces (e.g., ProductionDataTable).

Attributes: Attributes of tables are specified as name and type pairs in the Attributes table. To add a new attribute, click +Attribute.

Example

Image Removed

The details entered in the above Table Configuration form creates a table definition as follows:

Code Block
languagesql
Example

Image Removed

This source configuration is represented as follows in the source view.

Code Block
@Source(type = 'tcp', context='SweetProductionData', @map(type='binary'))
SourceNo connection can start from another Siddhi component and link to a source because a source is the point from which events selected into the event flow of the Siddhi application start.
Target

Streams

Sink

...

Image Removed

...

Once you add a source component to a Siddhi application in the design view, the Sink Configurations form appears below the grid. To configure the event sink, following information can be specified in this form:

  • Type: This specifies the transport via which the sink publishes processed events. The value should be entered in lower case (e.g., log ).
  • Properties: To add more properties to configure the source, you can click Properties next to Sink. Then select the Options check box and/or the Map check box to add sink options and/or to define the mapping details as required.
    • Options: This section allows you to add properties you want to configure for the selected transport. You can click + Option to add a new property. The value must be entered in the <PROPERTY_NAME>=<'PROPERTY_VALUE'> format (e.g., prefix='Sweet Totals' ).
    • Map: In this section, you can add the mapping type (i.e., the format in which the event is published) in the Name field in the Type sub section. If you want to add more configurations to the mapping, click Properties next to Map, and then select the Options check box and/or Attribute Mappings check box. For more information, see Siddhi Query Guide - Sink Mapper.
      • Options: This can be used to add additional properties to the @map annotation.
      • Attribute Mapping: You can add attributes as key and value pairs or as single attributes.

...

Image Removed

...

N/A

A sink cannot be followed by another Siddhi component because it represents the last stage of the event flow where the results of the processing carried out by the Siddhi application are communicated via the required interface.

  • Map Type: This specifies the format in which you want to receive the events (e.g., xml). The other parameters displayed for the map depends on the map type selected. If you want to add more configurations to the mapping, click Customized Options and set the required properties and key value pairs.
  • Map Attribute as Key/Value Pairs: If this check box is selected, you can define custom mapping by entering key value pairs. You can add as many key value pairs as required under this check box.

Example

Image Added

The details entered in the above form creates a source configuration as follows:

Code Block
@source(type = 'tcp', 
	@map(type = 'json', 
		@attributes(name = "$.sweet", amount = "$.batch.count")))
SourceNo connection can start from another Siddhi component and link to a source because a source is the point from which events selected into the event flow of the Siddhi application start.
Target

Streams


Sink

Icon

Image Added

DescriptionA sink publishes events via the specified transport and in the specified format. For more information, see Siddhi Query Guide - Sink .
Form

To configure the sink, click the settings icon on the sink component you added to the grid.

Info

To access the form in which you can configure a sink, you must first connect the sinke as the target object to a stream component.

  • Sink Type: This specifies the transport via which the sink publishes processed events. The value should be entered in lower case (e.g., log ).
  • Map Type: This specifies the format in which you want to publish the events (e.g., passThrough). The other parameters displayed for the map depends on the map type selected. If you want to add more configurations to the mapping, click Customized Options and set the required properties and key value pairs.
  • Map Attribute as Key/Value Pairs: If this check box is selected, you can define custom mapping by entering key value pairs. You can add as many key value pairs as required under this check box.

Example

Image Added

The details entered in the above form creates a sink configuration as follows:

Code Block
languagesql
@sink(type = 'log', prefix = "Sweet Totals:")
SourceStreams
Target

N/A

A sink cannot be followed by another Siddhi component because it represents the last stage of the event flow where the results of the processing carried out by the Siddhi application are communicated via the required interface.

Table

Icon

Image Added

DescriptionA table is a stored version of an stream or a table of events. For more information, see Siddhi Query Guide - Table.
Form

To configure the table, click the settings icon on the table component you added to the grid.

Name : This field specifies unique name for the table. This should be specified in title caps, and without spaces (e.g., ProductionDataTable).

Attributes: Attributes of tables are specified as name and type pairs in the Attributes table. To add a new attribute, click +Attribute.

Store Type: This specifies the specific database type in which you want to stopre data or whether the data is to be stored in-memory. Once the store type is selected, select an option to indicate whether the datastore needs to be defined inline, whether you want to use a datasource defined in the <SP_HOME>/conf/worker/deployment.yaml file, or connected to a JNDI resource. For more information, see Defining Tables for Physical Stores. The other parameters configured under Store Type depend on the store type you select.

Annotations: This section allows you to specify the table attributes you want to use as the primary key and indexes via the @primarykey and @index annotations. For more information, see Defining Data Tables. If you want to add any other custom annotations to your table definition, click +Annotation to define them.

Example

Image Added

The details entered in the aboveform creates a table definition as follows:

Code Block
languagesql
@store(type = 'rdbms', datasource = "SweetProductionDB")
define table ShipmentDetails (name string, supplier string, amount double);
Source
  • Projection queries
  • Window queries
  • Filter queries
  • Join queries
Target
  • Projection queries
  • Window queries
  • Filter queries
  • Join queries

...

Icon

DescriptionThis icon represents a window definition that can be shared across multiple queries. For more information, see Siddhi Query Guide - (Defined) Window.
Form

Once you add a To configure the window, click the settings icon on the window component you added to a Siddhi application in the design view, the Window Configuration form appears below the grid. To configure the window, following information can be specified in this form:the grid, and update the following information.

  • Name: This field specifies a unique name for the window. PascalCase is used for window names as a convention.
  • Attributes: Attributes of windows are specified as name and type pairs in the Attributes table.
  • Function NameWindow Type: This specifies the function of the window (i.e., the window type such as time, length, frequent etc.). The window types supported include time, timeBatch, timeLength, length, lengthBatch, sort, frequent, lossyFrequent, cron, externalTime, externalTimeBatch.
  • Parameters: This section allows you to define one or more parameters for the window definition based on the window type you entered in the Function Name field Window Type field.
  • Annotations: If you want to add any other custom annotations to your window definition, click +Annotation to define them.
Example

Image RemovedImage Added

The details entered in the above Window Configuration form creates a window definition as follows:

Code Block
languagesql
define window FiveMinTempWindow (roomNo int, temp double) time(5 min) output all events;
Source
  • Projection queries
  • Window queries
  • Filter queries
  • Join queries
Target
  • Projection queries
  • Window queries
  • Filter queries
  • Join queries

Trigger

Icon

Descriptiona A trigger allows you to generate events periodically. For more information, see Siddhi Query Guide - Trigger.
FormOnce you add a

To configure the trigger, click the settings icon on the trigger component you added to

a Siddhi application in the design view, the Trigger Configuration form appears below the grid. To configure the trigger, following information can be entered in this form:

the grid, and update the following information.

  • Name: A unique name for the trigger.
At
  • Trigger Criteria: This specifies the criteria based on which the trigger is activated. Possible values are as follows:
    • start: Select this to trigger events when the SP server has started.
    • every: Select this to specify a time interval at which
the
    • events
must
    • should be triggered
, or the
    • .
    • cron
expression based on which they are
    • -expression: Select this to enter a cron expression based on which the events can be triggered. For more information about cron expressions, see the quartz-scheduler.
Example


Image RemovedImage Added

The details entered in the above Trigger Configuration form orm creates a trigger definition as follows:

Code Block
languagesql
define trigger FiveMinTriggerStream at every 5 min;


SourceN/A
Target
  • Projection queries
  • Window queries
  • Filter queries
  • Join queries

...

Icon

Description

Incremental aggregation allows you to obtain aggregates in an incremental manner for a specified set of time periods. For more information, see Siddhi Query Guide - Incremental Aggregation.

Tip
titleBefore you add an aggregation:

Make sure that you have already added the stream with the events to which the aggregation is applied is already defined.

Form
Input:

Once a connection is made from a stream to an aggregation, move the cursor over the aggregation and To configure the aggregation, click the settings icon on the aggregation (shown below) to open the Aggregation Configuration form.
 Image Removed

The following information can be entered in this form:

component you added to the grid, and update the following information. 

  • Aggregation Meta Information: In this section, define a unique name for the aggregation in the Name field.Select, and specify the stream from which the input information is taken to perform the aggregations. You can also select the optional annotations you want to use in the aggregation definition by selecting the relevant check boxes. For more information about configuring the annotations once you select them, see Incremental Analysis.
  • Projection: This section specifies the attributes to be included in the aggregation query. In the Select field, you can select All attributes to perform the aggregation for all the attributes of the stream specified under Input, or select User Defined Attributes to select specific attributes. If you select User Defined Attributes, the User Defined Attributes table appears. In this tableyou can add attributes to be selected to be inserted into the output stream. Here, you can enter the the names of specific attributes to be selected, and specify the name with which each attribute is included in the aggregation. If an attribute value needs to be processed before it is included in the aggregation, you can enter the required expression to process it.Aggregate Byin the input stream, or enter expressions to convert input stream attribute values as required to generate output events. You can also specify the attribute(s) by which you want to group the output.
  • Aggregation Criteria: Here, you can specify the time values based on which the aggregates are calculated.
Example

Image RemovedImage Added

The details entered in the above Aggregation Configuration form creates an aggregation definition as follows:

Code Block
languagesql
define aggregation TradeAggregation
    from TradeStream
    select symbol, avg(price) as avgPrice, sum(price) as total
	group by symbol
	aggregate by aggregatetimestamp every seconds...years;
SourceN/A
TargetJoin queries

...

Icon

DescriptionThe function icon represents Script in Siddhi Query Language. It allows you to write functions in other programming languages and execute them within Siddhi queries. A function component in a Siddhi application is not connected to ther Siddhi components in the design UI. However, the configuration of one or more Query components can include a reference to it.
Form

Once you add a To configure the function, click the settings icon on the function component you added to a Siddhi application in the design view, the Function Configuration appears below the grid. To configure the function, following information can be specified in this form:the grid, and update the following information.

  • Name: A unique name for the function.
  • Script Type: The language in which the function is written.
  • Return Value: The data format of the value that is generated as the output via the function.
  • Script Body: This is a free text field to write the function in the specified script type.
Example

Image RemovedImage Added

The details entered in the above Function Configuration form creates a function definition as follows:

Code Block
languagesql
define function concatFN[JAVASCRIPT] return string {
    var str1 = data[0];
    var str2 = data[1];
    var str3 = data[2];
    var responce = str1 + str2 + str3;
    return responce;
};

Projection Query
Anchor
Projection
Projection

Icon

Description
Tip
iconfalse
titleBefore you add a projection query:

You need to add and configure the following:

  • The input stream with the events to be processed by the query.
  • The output stream to which the events processed by the query are directed.

This icon represents a query to project the events in an input stream to an output stream. This invoves selectng the attributes to be included in the output, renaming attributes, introducing constant values, and using mathematical and/or logical expressions. For more information, see Siddhi Query Guide - Query Projection

Form

Once you connect the query to an input stream (source) and an output stream (target), move the cursor over the query and you can configure it. To configure the projection query, click the settings icon on the projection query (shown below) to open the Query Configuration form.

Image Removed

The following information needs to be entered in this form:

Input

component you added to the grid, and update the following information.

  • Query Meta Information: This section specifies the stream to be considered as the input stream with the events to which the query needs to be applied. The input stream connected to the query as the source is automatically displayed.
  • SelectProjection: This section specifies the attributes to be included in the output. In the Select field, you can select All Attributes to select all the attributes of the events, or select User Defined Attributes to select specific attributes , and the expressions to convert them as required to generate output events.Output: This from the input stream. If you select User Defined Attributes, you can add attributes to be selected to be inserted into the output stream. Here, you can enter the names of specific attributes in the input stream, or enter expressions to convert input stream attribute values as required to generate output events. You can also specify the attribute(s) by which you want to group the output.
  • Output: This section specifies the action to be performed on the output event. The fields to be configured in this section are as follows:
    • Operation: This field specifies the operation to be performed on the generated output event (e.g., Insert to insert events to a selected stream/table/window).
    • Into: This field specifies the stream/table/window in which the operation specified need to be performed.
    • For: Event Type This field specifies whether the operation needs to be performed for all output events, only current events or for only expired events.|
Example

Image RemovedImage Added

The details entered in the above Query Configuration form creates a query definition as follows:

Code Block
languagesql
from TradeStream
select symbol, avg(price) as averagePrice, sum(amountvolume) as total
insert all events into OutputStream;
Source
  • Streams
  • Tables
  • Triggers
  • Windows
Target
  • Streams
  • Tables
  • Windows

Filter Query

You from TradeStream[sum(amount) > 10000] select symbol,
  • By default, the Stream Handler check box is selected, and a stream handler of the filter type is available under it to indicate that the query is a filter. Expand this stream handler, and enter the condition based on which the information needs to be filtered.

Icon

DescriptionA filter query filters information in an input stream based on a given condition. For more information, see Siddhi Query Guide - Filters.Form
Tip
iconfalse
titleBefore you add a filter query:
Tip
iconfalse
titleBefore you add a filter query:

You need to add and configure the following:

  • The input stream with the events to be processed by the query.
  • The output stream to which the events processed by the query are directed.

A filter query filters information in an input stream based on a given condition. For more information, see Siddhi Query Guide - Filters.

Form

Once you connect the query to an input stream (source) and an output stream (target), move the cursor over the query and you can configure it. To configure the filter query, click the settings icon on the filter query (shown below) to open the Query Configuration form.

Image Removed 

The following information needs to be entered in this form:

  • Input: This section specifies the stream to be considered as the input stream with the events to which the query needs to be applied. The input stream connected to the query as the source is automatically displayed.
  • Select

    component you added to the grid, and update the following information.

    Image Removed

    The details entered in the above Query Configuration form creates a query definition with a filter as follows:

    Code Block
    languagesql
    Info

    A Siddhi application can have multiple stream handlers. To add another stream handler, click the + Stream Handler. Multiple functions, filters and windows can be defined within the same form as stream handlers.

  • Projection: This section specifies the attributes to be included in the output. In the Select field, you can select All Attributes to select all the attributes of the events, or select User Defined Attributes to select specific attributes , and the expressions to convert them from the input stream. If you select User Defined Attributes, you can add attributes to be selected to be inserted into the output stream. Here, you can enter the names of specific attributes in the input stream, or enter expressions to convert input stream attribute values as required to generate output events. You can also specify the attribute(s) by which you want to group the output.
  • Output: This section specifies the action to be performed on the output event. The fields to be configured in this section are as follows:
    • Operation: This field specifies the operation to be performed on the generated output event (e.g., Insert to insert events to a selected stream/table/window).
    • Into: This field specifies the stream/table/window in which the operation specified need to be performed.
    • For: Event Type This field specifies whether the operation needs to be performed for all output events, only current events or for only expired events.
  • Stream Handlers: This section can be used to specify the filter criterion. To do this, select Filter in the Stream Handler field, and then enter the filter condition in the Filter Condition field.

    Info

    A Siddhi application can have multiple stream handlers. To add another stream handler, click the + Stream Handler. Multiple functions, filters and windows can be defined within the same form as stream handlers.

  • Example
    Example

    Image Added

    The details entered in the above form creates a query with a filter as follows:

    Code Block
    languagesql
    from TradeStream[sum(amount) > 10000]
    select symbol, avg(price) as averagePrice, sum(amount) as total
    insert all events into OutputStream;
    Source
    • Streams
    • Tables
    • Triggers
    • Windows
    Target
    • Streams
    • Tables
    • Windows

    Window Query

    ...

    Image Removed

    The details entered in the above form creates a query definition with a join as follows:

    Code Block
    languagesql
    from TempStream[temp > 30.0]#window.time(1 min) as T
      join RegulatorStream[isOn == false]#window.length(1) as R
      on T.roomNo == R.roomNo
    select T.roomNo, R.deviceID, 'start' as action
    insert into RegulatorActionStream;

    ...

    Info

    A join query must always be connected to two sources, and at least one of them must be a defined stream/trigger/window.

    • Streams
    • Tables
    • Aggregations
    • Windows

    ...

    Info

    A join query must always be connected to a single target.

    • Streams
    • Tables
    • Windows

    Pattern Query

    Icon

    Image Removed

    Description
    Tip
    iconfalse
    titleBefore you add a pattern query:

    You need to add and configure the following:

    • The input stream with the events to be processed by the query.
    • The output stream to which the events processed by the query are directed.

    A pattern query detects patterns in events that arrive overtime. For more information, see Siddhi Query Guide - Patterns.

    Form

    Once you connect the query to an input stream (source) and an output stream (target), move the cursor over the query and click the settings icon on the pattern query component (shown below) to open the Pattern Query Configuration form.
    Image Removed

    The following information is configured in the Pattern Query Configuration form:

    • Name: This field specifies a unique name for the pattern query.
    • Annotations: One or more annotations to be included in the pattern query can be entered in this section. To expand this section to add annotations, click Properties and select the Add Annotations check box. As a result, a single field appears to add an annotation as shown below. To add more annotation fields, click + Annotation.
      Image Removed
    • Input: This section displays the input streams that are currently connected to the pattern query as sources.
    • Conditions: This section defines the conditions based on which patterns are identified. This involves specifying a unique ID and the input stream considered for each condition. Multiple conditions can be added. To add a new condition, click +Condition.
    • Logic: This section defines the detailed logic based on which the pattern query output is generated.
    Example

    Image Removed

    The details entered in the above form creates a query definition with a pattern as follows:
    Icon

    Description
    Tip
    iconfalse
    titleBefore you add a window query:

    You need to add and configure the following:

    • The input stream with the events to be processed by the query.
    • The output stream to which the events processed by the query are directed.

    Window queries include a window to select a subset of events to be processed based on a specific criterion. For more information, see Siddhi Query Guide - (Defined) Window.

    Form

    Once you connect the query to an input stream (source) and an output stream (target), move the cursor over the query and you can configure it. To configure the window query, click the settings icon on the window query (shown below) to open the Query Configuration form.

    Image Removed

  • Input: This section specifies the stream to be considered as the input stream with the events to which the query needs to be applied. The input stream connected to the query as the source is automatically displayed.
  • Select

    component you added to the grid, and update the following information.

    • By default, the Stream Handler check box is selected, and a stream handler of the window type is available under it to indicate that the query is a filter. Expand this stream handler, and enter details to determine the window including the window type and the basis on which the subset of events considered by the window is determined (i.e., based on the window type selected).

      Info

      A Siddhi application can have multiple stream handlers. To add another stream handler, click the + Stream Handler. Multiple functions, filters and windows can be defined within the same form as stream handlers.

    • Projection: This section specifies the attributes to be included in the output. In the Select field, you can select All Attributes to select all the attributes of the events, or select User Defined Attributes to select specific attributes , and the expressions to convert them from the input stream. If you select User Defined Attributes, you can add attributes to be selected to be inserted into the output stream. Here, you can enter the names of specific attributes in the input stream, or enter expressions to convert input stream attribute values as required to generate output events. You can also specify the attribute(s) by which you want to group the output.
    • Output: This section specifies the action to be performed on the output event. The fields to be configured in this section are as follows:
      • Operation: This field specifies the operation to be performed on the generated output event (e.g., Insert to insert events to a selected stream/table/window).
      • Into: This field specifies the stream/table/window in which the operation specified need to be performed.
      • For: Event Type This field specifies whether the operation needs to be performed for all output events, only current events or for only expired events.
    • Stream Handlers: This section can be used to configure the window. To do this, select Window in the Stream Handler field, and then enter information in the following fields.

      • Window Name: A unique name for the window.
      • Parameter Value: This specifies a criterion based on which the window selects a subset of events to be processed. Multiple parameters can be added by clicking +Attribute.
      Info

      A Siddhi application can have multiple stream handlers. To add another stream handler, click the + Stream Handler. Multiple functions, filters and windows can be defined within the same form as stream handlers.

    Example

    Image Removed

    The details entered in the above form creates a query definition with a window as follows:

    Code Block
    languagesql
    from TradeStream#window.time(1 month)
    select symbol, avg(price) as averagePrice, sum(amount) as total
    insert all events into OutputStream;
    Source
    Info

    A window query can have only one source at a given time.

    • Streams
    • Tables
    • Triggers
    • Windows
    Target
    • Streams
    • Tables
    • Windows

    Join Query

    ...

    Image Removed

    ...

    Once you connect two Siddhi components to the join query as sources and another Siddhi component as the target, move the cursor over the join query and click the settings icon on the projection query (shown below) to open the Join Query Configuration form.

    Image Removed

    The following information needs to be entered in this form:

    Configurations common for both sources

    • Select: This section specifies the attributes to be included in the output. In the Select field, you can select All Attributes to select all the attributes of the events, or select User Defined Attributes to select specific attributes, and the expressions to convert them as required to generate output events.
    • Output: This section specifies the action to be performed on the output event. The fields to be configured in this section are as follows:
      • Operation: This field specifies the operation to be performed on the generated output event (e.g., Insert to insert events to a selected stream/table/window).
      • Into: This field specifies the stream/table/window in which the operation specified need to be performed.
      • For: This field specifies whether the operation needs to be performed for all output events, only current events or for only expired events.

    The stream handlers need to be separateley configured for the left source and the right source of the join.

    Configurations for each source

    ...

    • Input: Thes section specifies the input. This can be a stream, aggregation, window or a table for each source.
    • Stream Handlers: This section defines the functions, filters, and windows that can be included in the query to extract events from the left/right source.
    Example

    Image Added

    The details entered in the above Query Configuration form creates a query with a window as follows:

    Code Block
    languagesql
    from TradeStream#window.time(1 month)
    select symbol, avg(price) as averagePrice, sum(amount) as total
    insert all events into OutputStream;
    Source
    Info

    A window query can have only one source at a given time.

    • Streams
    • Tables
    • Triggers
    • Windows
    Target
    • Streams
    • Tables
    • Windows

    Join Query

    Icon

    Image Added

    DescriptionA join query derives a combined result from two streams in real-time based on a specified condition. For more information, see Siddhi Query Guide - Join.
    Form

    Once you connect two Siddhi components to the join query as sources and another Siddhi component as the target, you can configure the join query. To configure the join query, click the settings icon on the join query component you added to the grid and update the following information.

    • Query Meta Information: In this section, enter a unique name for the query and any annotations that you want to include in the query. The @dist annotation is supported by default to use the query in a fully distributed deployment if required (for more information, see Converting to a Distributed Streaming Application). You can also add customized annotations.
    • Input: Here, you can specify the input sources, the references, the join type, join condition, and stream handlers for the left source and right source of the join. For a detailed explanation of the join concept, see Siddhi Query Guide - Joins.
    • Projection: This section specifies the attributes to be included in the output. In the Select field, you can select All Attributes to select all the attributes of the events, or select User Defined Attributes to select specific attributes from the input stream. If you select User Defined Attributes , you can add attributes to be selected to be inserted into the output stream. Here, you can enter the names of specific attributes in the input stream, or enter expressions to convert input stream attribute values as required to generate output events. You can also specify the attribute(s) by which you want to group the output.
    • Output: This section specifies the action to be performed on the output event. The fields to be configured in this section are as follows:
      • Operation: This field specifies the operation to be performed on the generated output event (e.g., Insert to insert events to a selected stream/table/window).
      • Into: This field specifies the stream/table/window in which the operation specified need to be performed.
      • Event Type This field specifies whether the operation needs to be performed for all output events, only current events or for only expired events.
    Example

    A join query is configured as follows:

    Image Added
     
    The above configurations result in creating the following join query.

    Code Block
    languagesql
    from TempStream[temp > 30.0]#window.time(1 min) as T
      join RegulatorStream[isOn == false]#window.length(1) as R
      on T.roomNo == R.roomNo
    select T.roomNo, R.deviceID, 'start' as action
    insert into RegulatorActionStream;
    Source
    Info

    A join query must always be connected to two sources, and at least one of them must be a defined stream/trigger/window.

    • Streams
    • Tables
    • Aggregations
    • Windows
    Target
    Info

    A join query must always be connected to a single target.

    • Streams
    • Tables
    • Windows

    Pattern Query

    Icon

    Image Added

    Description
    Tip
    iconfalse
    titleBefore you add a pattern query:

    You need to add and configure the following:

    • The input stream with the events to be processed by the query.
    • The output stream to which the events processed by the query are directed.

    A pattern query detects patterns in events that arrive overtime. For more information, see Siddhi Query Guide - Patterns.

    Form

    Once you connect the query to an input stream (source) and an output stream (target), you can configure it. To configure the pattern query, click the settings icon on the pattern query component you added to the grid and update the following information.

    • Query Meta Information: In this section, enter a unique name for the query and any annotations that you want to include in the query. The @dist annotation is supported by default to use the query in a fully distributed deployment if required (for more information, see Converting to a Distributed Streaming Application). You can also add customized annotations.
    • Input: This section defines the conditions based on which patterns are identified. This involves specifying a unique ID and the input stream considered for each condition. Multiple conditions can be added. Each condition is configured in a separate tab within this section. For more information about the Pattern concept, see Siddhi Query Guide - Patterns .
    • Projection: This section specifies the attributes to be included in the output. In the Select field, you can select All Attributes to select all the attributes of the events, or select User Defined Attributes to select specific attributes from the input stream. If you select User Defined Attributes, you can add attributes to be selected to be inserted into the output stream. Here, you can enter the names of specific attributes in the input stream, or enter expressions to convert input stream attribute values as required to generate output events. You can also specify the attribute(s) by which you want to group the output.
    • Output: This section specifies the action to be performed on the output event. The fields to be configured in this section are as follows:
      • Operation: This field specifies the operation to be performed on the generated output event (e.g., Insert to insert events to a selected stream/table/window).
      • Into: This field specifies the stream/table/window in which the operation specified need to be performed.
      • Event Type This field specifies whether the operation needs to be performed for all output events, only current events or for only expired events.
    Example

    Image Added

    The above configuration results in creating the following query.

    Code Block
    languagesql
    from every (e1 =MaterialSupplyStream) RegulatorStream -> e2not = TempStream[e1.roomNoMaterialConsumptionStream[name == roomNo] < 1: > -> e3 = RegulatorStream[e1.roomNo == roomNo] 
    select e1.roomNo as roomNo, e2[0].temp - e2[last].temp as tempDiff e1.name and amount == e1.amount]
        for 15 sec
    select e1.name, e1.amount
    insert into TempDiffStreamProductionDelayAlertStream;
    Source
    • Streams
    • Tables
    • Triggers
    • Windows
    Target
    • Streams
    • Tables
    • Windows

    ...

    Sequence Query

    Icon

    Description
    Tip
    iconfalse
    titleBefore you add a sequence query:

    You need to add and configure the following:

    • The input stream with the events to be processed by the query.
    • The output stream to which the events processed by the query are directed.

    A sequence query detects sequences in event occurrences over time. For more information, see Siddhi Query Guide - Sequence.

    Form

    Once you connect the query to an input stream (source) and an output stream (target), move the cursor over the query and click the settings icon on the sequence query component (shown below) to open the Sequence Query Configuration form.

    Image Removed

    The following information is configured in the Sequence Query Configuration form:

    • Name: This field specifies a unique name for the sequence query.
    • Annotations: One or more annotations to be included in the sequence query can be entered in this section. To expand this section to add annotations, click Properties and select the Add Annotations check box. As a result, a single field appears to add an annotation as shown below. To add more annotation fields, click + Annotation.
      Image Removed
    • Input: This section displays the input streams that are currently connected to the sequence query as sources.
    • Conditions: This section defines the conditions based on which sequences are identified. This involves specifying a unique ID and the input stream considered for each condition. Multiple conditions can be added. To add a new condition, click +Condition.
    • Logic: This section defines the detailed logic based on which the sequence query output is generated.
    Example

    Image Removed

    The details entered in the above form creates a query definition with a sequence as follows:
    false
    titleBefore you add a sequence query:

    You need to add and configure the following:

    • The input stream with the events to be processed by the query.
    • The output stream to which the events processed by the query are directed.

    A sequence query detects sequences in event occurrences over time. For more information, see Siddhi Query Guide - Sequence.

    Form

    Once you connect the query to an input stream (source) and an output stream (target), you can configure it. To configure the sequence query, click the settings icon on the sequence query component you added to the grid and update the following information.

    • Query Meta Information: In this section, enter a unique name for the query and any annotations that you want to include in the query. The @dist annotation is supported by default to use the query in a fully distributed deployment if required (for more information, see Converting to a Distributed Streaming Application). You can also add customized annotations.
    • Input: This section defines the conditions based on which sequences are identified. This involves specifying a unique ID and the input stream considered for each condition. Multiple conditions can be added. Each condition is configured in a separate tab within this section. For more information about the Sequence concept, see Siddhi Query Guide - Sequences.
    • Projection: This section specifies the attributes to be included in the output. In the Select field, you can select All Attributes to select all the attributes of the events, or select User Defined Attributes to select specific attributes from the input stream. If you select User Defined Attributes, you can add attributes to be selected to be inserted into the output stream. Here, you can enter the names of specific attributes in the input stream, or enter expressions to convert input stream attribute values as required to generate output events. You can also specify the attribute(s) by which you want to group the output.
    • Output: This section specifies the action to be performed on the output event. The fields to be configured in this section are as follows:
      • Operation: This field specifies the operation to be performed on the generated output event (e.g., Insert to insert events to a selected stream/table/window).
      • Into: This field specifies the stream/table/window in which the operation specified need to be performed.
      • Event Type This field specifies whether the operation needs to be performed for all output events, only current events or for only expired events.
    Example

    Image Added

    The above configuration results in creating the following query.

    Code Block
    languagesql
    from every e1=SweetProductionStream, 
    e2=SweetProductionStream[e1.amount > amount and (timestamp - e1.timestamp) < 10 * 60000]*,
    e3= RegulatorStream , e2 = TempStream and e3 = HumidStream 
    select e2.temp as temp, e3.humid as humid SweetProductionStream[timestamp - e1.timestamp > 10 * 60000 and e1.amount > amount]
    select e1.name, e1.amount as initialAmount, e2.amount as finalAmount, e2.timestamp
    insert into StateNotificationStreamDecreasingTrendAlertStream;
    Source
    • Streams
    • Tables
    • Triggers
    • Windows
    Target
    • Streams
    • Tables
    • Windows

    Partitions

    Icon

    Image RemovedImage Added

    Description
    Tip
    titleBefore you add a partition:

    You need to add the stream to be partitioned.

    Partitions divide streams and queries into isolated groups in order to process them in parallel and in isolation. For more information, see Siddhi Query Guide - Partition.

    Form

    Once the stream to be partitioned is connected as a source to the partition, you can configure the partition. In order to do so, move the cursor over the partition and click the settings icon to open on the partition component. This opens the Partition Configuration form.

    Image Removed

    In this form, you can enter expressions to convert the attributes of the stream that is selected to be partitioned, to create output events.

    Example

    Image RemovedImage Added

    The above configuration creates the following partition query.

    Code Block
    languagesql
    partition with ( roomNo >= 1030 as 'serverRoom' or 
                     roomNo < 1030 and roomNo >= 330 as 'officeRoom' or 
                     roomNo < 330 as 'lobby' of TempStream)
    begin
        from TempStream#window.time(10 min)
        select roomNo, deviceID, avg(temp) as avgTemp
        insert into AreaTempStream
    end;
    SourceStreams
    TargetN/A

    ...

    In order to define how the Siddhi components in a Siddhi application interact with each other to process events, you need to define connections between Siddhi components. A connection is defined by drawing an arrow from one component to another by dragging the cursor as demonstrated below.

    Image RemovedImage Added

    Saving, running and debugging Siddhi applications

    ...