This repository has been archived by the owner on Feb 13, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from fieg/job-buried-event
Added job buried event
- Loading branch information
Showing
4 changed files
with
81 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
<?php | ||
|
||
namespace TreeHouse\WorkerBundle\Event; | ||
|
||
use Pheanstalk\Job; | ||
use Symfony\Component\EventDispatcher\Event; | ||
|
||
class JobBuriedEvent extends Event | ||
{ | ||
/** | ||
* Number of attempts before job got buried | ||
* | ||
* @var int | ||
*/ | ||
protected $attempts; | ||
|
||
/** | ||
* @var Job | ||
*/ | ||
protected $job; | ||
|
||
/** | ||
* Exception that caused the job to be buried | ||
* | ||
* @var \Exception | ||
*/ | ||
protected $exception; | ||
|
||
/** | ||
* JobBuriedEvent constructor. | ||
* | ||
* @param Job $job | ||
* @param \Exception $exception | ||
* @param int $attempts | ||
*/ | ||
public function __construct(Job $job, \Exception $exception, $attempts) | ||
{ | ||
$this->job = $job; | ||
$this->exception = $exception; | ||
$this->attempts = $attempts; | ||
} | ||
|
||
/** | ||
* @return Job | ||
*/ | ||
public function getJob() | ||
{ | ||
return $this->job; | ||
} | ||
|
||
/** | ||
* @return \Exception | ||
*/ | ||
public function getException() | ||
{ | ||
return $this->exception; | ||
} | ||
|
||
/** | ||
* @return int | ||
*/ | ||
public function getAttempts() | ||
{ | ||
return $this->attempts; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters