mirror of
https://github.com/archtechx/jobpipeline.git
synced 2025-12-13 03:34:04 +00:00
updating docs
This commit is contained in:
parent
29fb12fd4b
commit
a9c716d1a1
1 changed files with 30 additions and 0 deletions
30
README.md
30
README.md
|
|
@ -50,6 +50,8 @@ Next, decide if you want to queue the pipeline. By default, pipelines are synchr
|
||||||
> 🔥 If you **do** want pipelines to be queued by default, you can do that by setting a static property:
|
> 🔥 If you **do** want pipelines to be queued by default, you can do that by setting a static property:
|
||||||
`\Stancl\JobPipeline\JobPipeline::$shouldBeQueuedByDefault = true;`
|
`\Stancl\JobPipeline\JobPipeline::$shouldBeQueuedByDefault = true;`
|
||||||
|
|
||||||
|
or:
|
||||||
|
|
||||||
```php
|
```php
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
|
@ -66,6 +68,34 @@ JobPipeline::make([
|
||||||
})->shouldBeQueued(true)
|
})->shouldBeQueued(true)
|
||||||
```
|
```
|
||||||
|
|
||||||
|
If you want to push the job to a different queue, you can pass a string as a parameter, instead of a boolean: `shouldBeQueued('another-queue')`.
|
||||||
|
|
||||||
|
The following methods are available too, for further configuration if needed:
|
||||||
|
- `onConnection(string $connection)`
|
||||||
|
- `onQueue(string $queue)`
|
||||||
|
- `delay($delay)`
|
||||||
|
- `tries($tries)`
|
||||||
|
|
||||||
|
```php
|
||||||
|
<?php
|
||||||
|
|
||||||
|
use Stancl\Tenancy\Events\TenantCreated;
|
||||||
|
use Stancl\JobPipeline\JobPipeline;
|
||||||
|
use Stancl\Tenancy\Jobs\{CreateDatabase, MigrateDatabase, SeedDatabase};
|
||||||
|
|
||||||
|
JobPipeline::make([
|
||||||
|
CreateDatabase::class,
|
||||||
|
MigrateDatabase::class,
|
||||||
|
SeedDatabase::class,
|
||||||
|
])->send(function (TenantCreated $event) {
|
||||||
|
return $event->tenant;
|
||||||
|
})->shouldBeQueued(true)
|
||||||
|
->onConnection('connection-different-from-default')
|
||||||
|
->onQueue('queue-different-from-default')
|
||||||
|
->delay(5)
|
||||||
|
->tries(2);
|
||||||
|
```
|
||||||
|
|
||||||
Finally, convert the pipeline to a listener and bind it to an event:
|
Finally, convert the pipeline to a listener and bind it to an event:
|
||||||
|
|
||||||
```php
|
```php
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue