2

I have a CakePHP/MySQL project that has task pipe for processing different types of tasks. Tasks are added to mysql database in single table and fetched with php script and executed. I have done this by using cron but I was wondering if there is simple way to create some kind of listener to watch over table changes. This would result tasks run faster, cause cron loops minimum only once per one minute.

I have researched and tried before RabbitMQ (which is quite good) but in this project I cant do such refactoring (cause of deadlines) at this time and I would like to have simple and working way to do this with php/mysql.

Any suggestions?

I have very little knowledge of other programming languages eg. python etc.. but I was wondering if some other language would have better capabilities to run as service and poll database??

makallio85
  • 1,366
  • 2
  • 14
  • 29
  • Can you not use a MySQL trigger? http://dev.mysql.com/doc/refman/5.6/en/trigger-syntax.html – David Nguyen Jan 07 '14 at 15:48
  • I did read that is considered as "bad practice", triggering php via mysql – makallio85 Jan 07 '14 at 15:49
  • okay I understand now, I definitely think that CRON jobs would be the best way to approach this (minus real time processing) but I do not have experience in what you are asking – David Nguyen Jan 07 '14 at 15:53
  • We have used cron long time and it is good. Now I would just make it little better by making jobs run little faster. – makallio85 Jan 07 '14 at 15:55
  • possible duplicate of [Invoking a PHP script from a mysql trigger](http://stackoverflow.com/questions/1467369/invoking-a-php-script-from-a-mysql-trigger) – Markus Malkusch Jan 07 '14 at 16:27
  • Hi, referring to this: http://stackoverflow.com/questions/3651951/mysql-triggers-after-insert-trigger-udf-sys-exec-issue ,this solution doesn't work for situation here as I would like. After research I am sure that what I am looking for is that trigger could pass inserted id to the php script as argument. – makallio85 Jan 07 '14 at 18:38

0 Answers0