mirror of
https://github.com/archtechx/jobpipeline.git
synced 2025-12-12 15:14:04 +00:00
Add $queue attribute
This code enables me to change the queue name that the JobPipeline will be pushed to.
Now I can do something like this:
```php
JobPipeline::make([
Jobs\CreateDatabase::class,
Jobs\MigrateDatabase::class,
// Jobs\SeedDatabase::class,
// Your own jobs to prepare the tenant.
// Provision API keys, create S3 buckets, anything you want!
])->send(function (Events\TenantCreated $event)
{
return $event->tenant;
})->onQueue('another-queue')
->shouldBeQueued()
```
This commit is contained in:
parent
bfc53f6dd6
commit
c75c76e49a
1 changed files with 10 additions and 0 deletions
|
|
@ -26,6 +26,9 @@ class JobPipeline implements ShouldQueue
|
||||||
|
|
||||||
/** @var bool */
|
/** @var bool */
|
||||||
public $shouldBeQueued;
|
public $shouldBeQueued;
|
||||||
|
|
||||||
|
/** @var string */
|
||||||
|
public $queue;
|
||||||
|
|
||||||
public function __construct($jobs, callable $send = null, bool $shouldBeQueued = null)
|
public function __construct($jobs, callable $send = null, bool $shouldBeQueued = null)
|
||||||
{
|
{
|
||||||
|
|
@ -56,6 +59,13 @@ class JobPipeline implements ShouldQueue
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function onQueue(string $queue)
|
||||||
|
{
|
||||||
|
$this->queue = $queue;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
public function handle(): void
|
public function handle(): void
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue