-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Starting to integrate the EventDispatcher
Adding a few events to the main Worker class. Each event will be able to cancel a Job / Worker from running.
- Loading branch information
1 parent
e2a0f10
commit 33988d6
Showing
13 changed files
with
301 additions
and
35 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
vendor | ||
phpunit.xml |
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,62 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the Presque package. | ||
* | ||
* (c) Justin Rainbow <justin.rainbow@gmail.com> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Presque\Event; | ||
|
||
use Presque\JobInterface; | ||
use Presque\QueueInterface; | ||
use Presque\WorkerInterface; | ||
|
||
class JobEvent extends Event | ||
{ | ||
private $worker; | ||
private $canceled; | ||
|
||
public function __construct(JobInterface $job, QueueInterface $queue, WorkerInterface $worker) | ||
{ | ||
$this->job = $job; | ||
$this->queue = $queue; | ||
$this->worker = $worker; | ||
$this->canceled = false; | ||
} | ||
|
||
public function getJob() | ||
{ | ||
return $this->job; | ||
} | ||
|
||
public function setJob(JobInterface $job) | ||
{ | ||
$this->job = $job; | ||
|
||
return $this; | ||
} | ||
|
||
public function getQueue() | ||
{ | ||
return $this->queue; | ||
} | ||
|
||
public function getWorker() | ||
{ | ||
return $this->worker; | ||
} | ||
|
||
public function cancel() | ||
{ | ||
$this->canceled = true; | ||
} | ||
|
||
public function isCanceled() | ||
{ | ||
return $this->canceled; | ||
} | ||
} |
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
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
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
Oops, something went wrong.