I have a database (currently MySQL, FWIW) that receives data from a variety of sources. I would like to execute a variety of external processes if data meeting specific criteria are inserted or updated to the database.
Does anybody know of a mechanism to do this?
I've looked into triggers & stored procedures, but if I'm understanding things correctly, they only work within the database, and can't execute external programs.
I could poll the database at intervals, but the number of criteria to be polled on could become large, and some of the stuff is time critical so the polling interval would have to be short, leading to possibly stomping the database pretty hard.
I could embed the notification stuff in the many mechanisms that can insert/update to the db, but that promises to be a maintenance nightmare, and I may not always have direct control over some of these mechanisms.
What I'm considering is writing a chunk of "middleware" that sits between the db, and the applications inserting/updating the db. These apps would connect to the middleware instead of the DB. The middleware would parse the query to look for the triggers, and perform whatever needs to be done if they are met. It would then pass the query on to the db.
Reasonable? Stupid? Already exists?
Does anybody know of a mechanism to do this?
I've looked into triggers & stored procedures, but if I'm understanding things correctly, they only work within the database, and can't execute external programs.
I could poll the database at intervals, but the number of criteria to be polled on could become large, and some of the stuff is time critical so the polling interval would have to be short, leading to possibly stomping the database pretty hard.
I could embed the notification stuff in the many mechanisms that can insert/update to the db, but that promises to be a maintenance nightmare, and I may not always have direct control over some of these mechanisms.
What I'm considering is writing a chunk of "middleware" that sits between the db, and the applications inserting/updating the db. These apps would connect to the middleware instead of the DB. The middleware would parse the query to look for the triggers, and perform whatever needs to be done if they are met. It would then pass the query on to the db.
Reasonable? Stupid? Already exists?