MySQL trigger a nodered node?

460 views
Skip to first unread message

Jéan Roux

unread,
Jun 25, 2017, 2:17:57 PM6/25/17
to Node-RED
Hi, is there a way to get a MySQL trigger to trigger an event in NodeRed?

An application could for instance be to check for new records inserted, from outside of nodered.

One way I can think - is to have a query in NodeRed that checks - every 5 min, for new records.

But is there any other way, to trigger it from a MySQL trigger itself?

Julian Knight

unread,
Jun 26, 2017, 6:57:51 PM6/26/17
to Node-RED
I can't think of one. SQL Databases generally don't publish public events AFAIK.

Glenn

unread,
Jun 27, 2017, 12:31:11 AM6/27/17
to Node-RED
You generally query the database not the other way round.

I would have the application post to MQTT and the DB if possible.

Otherwise the only other option is to use an inject node and query but it wouldn't be that great performance wise (i wouldn't think).

Julian Knight

unread,
Jun 27, 2017, 2:08:24 AM6/27/17
to Node-RED
Well you could use a trigger to update a flag small table, that would be pretty efficient to query regularly but not as efficient as the notifications from MQTT as you say. 

Dave C-J

unread,
Jun 27, 2017, 2:38:10 AM6/27/17
to Node-RED
Jean, you would need to look at UDF, user defined functions https://dev.mysql.com/doc/refman/5.7/en/adding-udf.html
Basically write a C or C++ extension to do whatever you want.... Eg make an MQTT or other trigger into Node-RED

Dave C-J

unread,
Jun 27, 2017, 2:39:43 AM6/27/17
to node...@googlegroups.com

Jéan Roux

unread,
Jun 27, 2017, 12:32:54 PM6/27/17
to Node-RED
Wow, Julian, Glenn, Dave, thank you, lots of food for thought on what my options are, thank you!!!!
Reply all
Reply to author
Forward
0 new messages