Siddhi Application

Provides introduction to the concept of Siddhi Application.

Siddhi App provides an isolated execution environment for processing the execution logic. It can be deployed and processed independently of other SiddhiApps in the system. Siddhi Apps can use inMemory sources and sinks to communicate between each other.

@app:name('Temperature-Processor')
@app:description('App for processing temperature data.')

@source(type='inMemory', topic='SensorDetail')
define stream TemperatureStream (
                  sensorId string, temperature double);

@sink(type='inMemory', topic='Temperature')
define stream TemperatureOnlyStream (temperature double);

@info(name = 'Simple-selection')
from TemperatureStream
select temperature
insert into TemperatureOnlyStream;
@app:name('Temperature-Processor')

Name of the Siddhi Application

@app:description('App for processing temperature data.')

Optional description for Siddhi Application

@source(type='inMemory', topic='SensorDetail')
define stream TemperatureStream (
                  sensorId string, temperature double);

InMemory source to consume events from other Siddhi Apps.

@sink(type='inMemory', topic='Temperature')
define stream TemperatureOnlyStream (temperature double);

InMemory sink to publish events from other Siddhi Apps.

@info(name = 'Simple-selection')
from TemperatureStream
select temperature
insert into TemperatureOnlyStream;

Input

When an event ['aq-14', 35.4] is pushed via the SensorDetail topic of the inMemory transport from another Siddhi App, the event will be consumed and mapped to the TemperatureStream stream.

Output

After processing, the event [35.4] arriving at TemperatureOnlyStream will be emitted via Temperature topic of the inMemory transport to other subscribed Siddhi Apps.

Top