Mixing push and pull events, with conditional sensor execution

In this example, we will learn how to trigger a polling sensor after stream data is processed. We used the same template from the first example. Now we have added a polling sensor that triggers on * -> *, meaning that it will trigger every time after the stream data node is executed (which results in the new state: Below, Equal or Above).


If we start a task using this template (e.g. saved as “template3”) in the reactive mode like this:

 curl --user apiKey:apiSecret -H "Content-Type:application/json" -X POST -d '{
    "name": "Stream processing",
    "template": "template3",
    "resource": "testresource",
    "type": "reactive"
  }' https://sandbox.waylay.io/api/tasks

and if data gets pushed via broker:

 curl --user apiKey:apiSecret
    -H "Content-Type: application/json"
    -X POST  
    -d '{
         "temperature": 23,
         "humidity": 73,
         "resource": "testresource",
         "domain": "sandbox.waylay.io"

We can see the debug message any time new data arrives (with temperature above 21)