-
Notifications
You must be signed in to change notification settings - Fork 11.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[10.x] Adds JobQueueing event (#49722)
* Adds JobQueueing event * style fixes * fix broken tests * fix broken tests
- Loading branch information
Showing
8 changed files
with
120 additions
and
28 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 |
---|---|---|
@@ -0,0 +1,58 @@ | ||
<?php | ||
|
||
namespace Illuminate\Queue\Events; | ||
|
||
use RuntimeException; | ||
|
||
class JobQueueing | ||
{ | ||
/** | ||
* The connection name. | ||
* | ||
* @var string | ||
*/ | ||
public $connectionName; | ||
|
||
/** | ||
* The job instance. | ||
* | ||
* @var \Closure|string|object | ||
*/ | ||
public $job; | ||
|
||
/** | ||
* The job payload. | ||
* | ||
* @var string|null | ||
*/ | ||
public $payload; | ||
|
||
/** | ||
* Create a new event instance. | ||
* | ||
* @param string $connectionName | ||
* @param \Closure|string|object $job | ||
* @param string|null $payload | ||
* @return void | ||
*/ | ||
public function __construct($connectionName, $job, $payload = null) | ||
{ | ||
$this->connectionName = $connectionName; | ||
$this->job = $job; | ||
$this->payload = $payload; | ||
} | ||
|
||
/** | ||
* Get the decoded job payload. | ||
* | ||
* @return array | ||
*/ | ||
public function payload() | ||
{ | ||
if ($this->payload === null) { | ||
throw new RuntimeException('The job payload was not provided when the event was dispatched.'); | ||
} | ||
|
||
return json_decode($this->payload, true, flags: JSON_THROW_ON_ERROR); | ||
} | ||
} |
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
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