1
0
Fork 0
mirror of https://github.com/archtechx/jobpipeline.git synced 2025-12-12 13:54:03 +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:
Jonathan Prass Martins 2023-02-25 11:13:37 -03:00 committed by GitHub
parent bfc53f6dd6
commit c75c76e49a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -26,6 +26,9 @@ class JobPipeline implements ShouldQueue
/** @var bool */
public $shouldBeQueued;
/** @var string */
public $queue;
public function __construct($jobs, callable $send = null, bool $shouldBeQueued = null)
{
@ -56,6 +59,13 @@ class JobPipeline implements ShouldQueue
return $this;
}
public function onQueue(string $queue)
{
$this->queue = $queue;
return $this;
}
public function handle(): void
{