Event processing with Node-RED

118 views
Skip to first unread message

Vlad Livshitz

unread,
Aug 2, 2015, 12:39:01 PM8/2/15
to Node-RED
Hello,

I would like to do  "simple event processing" with node-RED,

For example, i have following use cases:

* For time window of 2 hours calculate average time interval between message arrivals
* For time windows of 5 hours calculate some maximal value

Moreover, i would like to differentiate messages by, say, groupId, and calculate these values for each group separately,

The most closest thing that i found yet, is the "Smooth" node from the contribution library,
However, this node has limited functionality, and calculate average value by  number of last occurrences, either time windows.

I'm looking for  tips, what should be a best practice for such kind of tasks?

Also I found out that there are event processing libraries for Node.js. Is these libraries can be used with Node-RED?

Thank you

Julian Knight

unread,
Aug 3, 2015, 7:52:22 AM8/3/15
to Node-RED
Hi Vlad,

I think most people are probably doing that kind of calculation with a database of some sort such as MongoDB. You can post the details to the database and then have a query that calculates the average and/or max values with grouping as required.

You can do it in memory too using a function node but of course, if the system crashes, you've lost your in-progress calculation.

Franklin Dattein

unread,
Aug 3, 2015, 8:51:07 PM8/3/15
to Node-RED
I do pretty much what Julian said.
All the data my app collects gets published as an MQTT event. In Node Red there is a flow that listens to those events, do some processing and save it in mongo. Then you could have a inputs every 2 and 5 hours, to run the calculations you mentioned.
Reply all
Reply to author
Forward
0 new messages