I am working on a project that is using Phirehose to collect and consume the Twitter Streaming API. The Phirehose library is designed to be run from the command line, preferably as a daemon or cron job.
I created a daemon and placed it in the library folder. Bootstrap.php has been updated to autoload the custom library. So, the application itself has no problem seeing my daemon.
My issue is how to integrate it properly with Zend Framework. I need to be able to call the daemon file directly to start it from the command line or using a tool such as Upstart, but in doing so the Zend application doesn't load which means I don't have access to my models.
I could create a controller to start it, but I don't want to add the security issue of somebody being able to control the daemon from a web interface. I could also write the PDO to manually connect to the database, but I'm trying to avoid it for scaling reasons. I'd prefer all database connection data reside in application.ini.
Is there a way, within my daemon class, to initialize my Zend Framework application so I can use the models?
This example demonstrates how I perform background tasks using Zend_Queue. In this particular example I'm generating invoices in background using Zend_Queue and cronjob, my Zend_Queue is initialised and registered in bootstrap.
Creating a job, My_Job source is here:
Registering job, somewhere inside your service or model:
Creating background script: