Install a monitor for beanstalkd, which can be useful when developing / testing your application. Some alternatives that PHP uses are: http://mnapoli.imtqy.com/phpBeanstalkdAdmin/ and https://github.com/ptrofimov/beanstalk_console
As for error handling, you can define your own error handler for beanstalkd jobs and in this handler decide whether you want to:
- to bury (to postpone work for subsequent verification)
- hit (return it to the queue)
- delete (delete it if it is safe for your application)
EDIT - Did you solve your problem? A better way would be to use try / catch around your assignments to catch the exceptions and then bury it if the employee has an exception. If an exception is raised by the manufacturer, it probably is never added to the queue, so there is no need to bury (), but use a monitor to make sure.
If you want to try to define your own error handler for your object, I already did something similar before by setting up my own error handler for your class. It might be an ugly hack trying to get a pheanstalk (job) object via $ errcontext - but there might be something to try. Here is some pseudo code that I quickly compiled if you want to try it (create a subclass to avoid putting the code in the pheanstalk class):
class MyPheanstalk extends Pheanstalk { function __construct() { //register your custom error_handler for objects of this class set_error_handler(array($this, 'myPheanstalk_error_handler')); //call parent constructor parent::__construct(); } function myPheanstalk_error_handler($errno, $errstr, $errfile, $errline, $errcontext) { // get the current job that failed foreach($errcontext as $val) //print_r($errcontext) to find info on the object(job) you are looking for { if(is_object($val)) { if(get_class($val) == 'Pheanstalk') { //and replace with correct class here //optionally check errstr to decide if you want to delete() or kick() instead of bury() $this->bury($val); } } } } }
source share