Hello again,
I am wondering if there’s an efficient way to configure some sort of messaging system to fire an event whenever a new row has been added to a database table without constantly querying the database? I was thinking to use the gateway’s AlarmManager but I can’t seem to find adequate examples of how to use it properly. Would that be the way to go to accomplish what I need to do?
A query tag with a value change event script would probably be the easiest way. Unfortunately that will end up polling the database as will pretty much everything else you could do. You would have to find some way for the database server to initiate the connection instead of ignition I’m not sure if there a way to do that.
Don’t worry about periodically running a SQL query - it’s what databases are made to do and they’re incredibly fast and efficient at it. Even across the Internet this can be done in a handful of milliseconds - locally even faster than that.
You can’t find out whether a database has changed without looking at the database, unless you want to somehow monitor everything on its way in which would be much more hassle.
Alright, thanks for the help! I guess I will just query the DB every few seconds if it’s not going to cause a performance issue.