2
require_once dirname(__FILE__) . '/Failure/Interface.php';
7
* @package Resque/Failure
8
* @author Chris Boulton <chris.boulton@interspire.com>
9
* @copyright (c) 2010 Chris Boulton
10
* @license http://www.opensource.org/licenses/mit-license.php
15
* @var string Class name representing the backend to pass failed jobs off to.
17
private static $backend;
20
* Create a new failed job on the backend.
22
* @param object $payload The contents of the job that has just failed.
23
* @param object $exception The exception generated when the job failed to run.
24
* @param object $worker Instance of Resque_Worker that was running this job when it failed.
25
* @param string $queue The name of the queue that this job was fetched from.
27
public static function create($payload, Exception $exception, Resque_Worker $worker, $queue)
29
$backend = self::getBackend();
30
new $backend($payload, $exception, $worker, $queue);
34
* Return an instance of the backend for saving job failures.
36
* @return object Instance of backend object.
38
public static function getBackend()
40
if(self::$backend === null) {
41
require dirname(__FILE__) . '/Failure/Redis.php';
42
self::$backend = 'Resque_Failure_Redis';
45
return self::$backend;
49
* Set the backend to use for raised job failures. The supplied backend
50
* should be the name of a class to be instantiated when a job fails.
51
* It is your responsibility to have the backend class loaded (or autoloaded)
53
* @param string $backend The class name of the backend to pipe failures to.
55
public static function setBackend($backend)
57
self::$backend = $backend;
b'\\ No newline at end of file'