I guess I don’t really have to explain what JobQueue does, as the name basically says it all: Using this, you can queue jobs that need to be performed. I usually use cronjobs for this, but that is especially useful for jobs that you know will need to be done. If you want to dynamically queue jobs, it’s getting more complicated: You’ll then have to have a cronjob that looks into a custom built queue (probably a database) to run certain tasks. Nice, but can be annoying, mostly because the whole queue and execution logic needs to be developed by you yourself.
In the case of Zend Platform’s JobQueue, all this is taken care of by Zend Platform. It even provides some nice classes to connect to the queue and add jobs to it, or even manage jobs. For a project I’m currently working on at work, we use this technology, and even though I’ve just been working with this for a very short while, I’m very impressed at the ease of use of this.
So why is it useful? Well, as I already mentioned, aside from simply planning recurring jobs at specific times, you can aso dynamically add jobs to the queue. This is especially useful if you need to do resource-intensive or time-consuming processing that you don’t want the user to wait for. You simply add the job of processing to the queue, and the user page can load with an acceptable speed. The job will do the processing (you define the script which does the processing). You need of course to take into account that depending on the length of the queue or the load on the server, processing can take a while, and not depend on the result of the processing in any scripts without ensuring that things can also work without the result.
The JobQueue is not a key selling point for the platform, but if you have Zend Platform available, then it’s well worth your time looking at using it if you need something like this.
Leave a Reply