php-resque

PHP-Resque failed jobs list


I have successfully integrated PHP RESQUE in my Ubuntu 14.

How can I get list of failed jobs in PHP to process them? I tried searching on web but could not find specific answer for PHP.

Please help. Thanks in advance.


Solution

  • You have two options: one is using the Resque-web UI: https://github.com/resque/resque-web if you want to install it from scratch or, better yet, there is a Docker container that makes it easy to get it up and running: https://hub.docker.com/r/ennexa/resque-web/~/dockerfile/

    Resque-web has a tab to see the failed jobs and the option to reprocess them.

    Programmatically, I don't think there is a built-in method that would allow that so I guess you would have to be creative here. For example, from resque-php Github page: You have the ability to retrieve a token identifying a job when you create it:

    $token = Resque::enqueue('default', 'My_Job', $args, true);
    

    With that information, you can then retrieve the job status:

    $status = new Resque_Job_Status($token);
    echo $status->get(); // Outputs the status
    

    You will want to check for this:

    Resque_Job_Status::STATUS_FAILED
    

    This also might give you some ideas: https://github.com/chrisboulton/php-resque/issues/324