I am looking to make a system similar to IFTTT, where a user can define things such as:"If GROUP_A has an AVERAGE value of AVG_VALUE, then SEND_EMAIL to EMAIL_ADDRESS with BODY "BODY" and SUBJECT "SUBJECT"or"If SENSOR_B sends value RECV_VALUE, then SEND_JSON to SENSOR_C with contents JSON_CONTENT"All of these would be stored in a database, along with all the sensor/group data.My question is this: How would I best go about efficiently monitoring/responding to these events?My thought is to have another Node process monitoring the database at an interval (say every 10-15 seconds), running through all the entries of "If X do Y", seeing if any criteria is met, and then firing off valid events.I don't know if this is the most performant method however, as there could theoretically be hundreds of "If X do Y"'s turned on at the same time. I would for sure implement some sort of caching so the tasks aren't constantly being pulled from the DB, but beyond that my main concern is still how to best optimize this.Thanks all.
Submitted February 12, 2019 at 02:40AM by Fibrechips
No comments:
Post a Comment