Kind of crazy file watch mechanism
Posted on 2007-11-24
This is kind of crazy and was looking for advice. I have a mysql database. Some external process may write a record to my table, which should start a new process. Something like:
1) Mysql database is created
2) Some external process creates a new record in the table with data 192.168.1.2, "hello"
3) I want a local process to be created now and send data "hello" to 192.168.1.2
I was hoping to use triggers but you can't start processes with them, and besides i think the code is specific to mysql. I'm using an odbc lib so was hoping to make this generic so any db could work in place of mysql.
The only generic solution I can come up with is having a process that just polls the table of interest every 10 seconds and handles any new records it finds. I hate polling but I don't know a better way to handle this. Anyone have any better ideas?