Using gates as the control flow

This example will build on top of the previous example, which explores the use of eviction policy. Both streamDataSensors are configured with eviction time of 5 seconds. Compared to previous example, we have added a Gate, that will be true only if both sensors are in Above state. We also use the Function node, which allows us to make computation based on the raw data collected by other sensors. In order to make sure that Function node has data required for computation (in this case call AvgTemp), we also used conditional execution of the sensors feature. This way, we make sure that we will compute average temperature of two different sensors only if data of sensors come within 5 seconds:


We will start a task using this template (e.g. saved as “mix_streams_formula”) in the reactive mode like this:

 curl --user apiKey:apiSecret -H "Content-Type:application/json" -X POST -d '{
    "name": "Stream processing with formula",
    "template": "mix_streams_formula",
    "type": "reactive"

Let’s pushed data for both resources via broker:

curl --user apiKey:apiSecret
 -H "Content-Type: application/json"
 -X POST  
 -d '[{
      "temperature": 33,
      "resource": "test1",
      "domain": ""
      "temperature": 20,
      "resource": "test2",
      "domain": ""

Let’s see what happens, we have received the average temperature. Great! image