LF eKuiper Weekly Dev Meeting 20210730
Attendances
Topics
jsonpath: Support to query index
Problem: can filter an array to get the value:
$.friends[?(@.age>60)]
. However, it cannot get the index which meets the condition. It is eagerly needed when we need to access the items around the filtered item. For example, to find the first item that ages become less or equal to 60, we need to get the last index of the previous filter, and + 1.Proposals:
Extend JSON path to support
- Open issue for our json path dependency
- Find other jsonpath libs: : is promising, but the library is written in Java
- Fork and update by ourselves. This is promising and partially done
Extend built in array functions: ref
array_positions
(anyarray
,anyelement
): Do NOT support the filter script, so can only be used to position a known element
Rule pipeline by memory
Problem: Effectively link multiple rules. Better to be set up free.
Proposal: Add memory source and memory sink.
All rules can form a pipeline by the pair of memory source + memory sink
## Rule 1: filter
{
"id": "rule1",
"sql": "select collect(*) as all from demo group by CountWindow(2, 1) where all[1].temperature != all[0].temperature",
"actions": [{
"mqtt": {
},
"memory":{
"dataTemplate": "...template to select only the current item",
"name": "onTemperatureChange"
}
}]
}
## Stream tempStream to connect to the output
{"sql" : "create stream tempStream() WITH (DATASOURCE=\"onTemperatureChange\", FORMAT=\"JSON\", TYPE=\"memory\")"}
## Rule 2, pipeline to the changed temperature to do further analyze
{
"id": "rule1",
"sql": "select * from tempStream where temperature > 29",
"actions": [{
"mqtt": {
},
"rest": {
// command to trigger air conditioner when the temperature changed and above 29
}
}]
}
# Other rules can use that stream to do another kind of calculationRelease schedule
v1.3.0 next week, go with EdgeX app service 2.0.1
Remaining work
Kuiper manager 1.3.0
Tutorial to connect to EdgeX message bus
Board Review