🗃️ Add priority to queue
This commit is contained in:
parent
7f4f005302
commit
61f9cfb009
7 changed files with 171 additions and 2 deletions
8
app/Jobs/Concerns/HasPriority.php
Normal file
8
app/Jobs/Concerns/HasPriority.php
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
<?php
|
||||
|
||||
namespace App\Jobs\Concerns;
|
||||
|
||||
interface HasPriority
|
||||
{
|
||||
public function getPriority(): ?int;
|
||||
}
|
||||
|
|
@ -9,7 +9,7 @@ use Illuminate\Foundation\Bus\Dispatchable;
|
|||
use Illuminate\Queue\InteractsWithQueue;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
|
||||
class SayHello implements ShouldQueue
|
||||
class SayHello implements ShouldQueue, Concerns\HasPriority
|
||||
{
|
||||
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
|
||||
|
||||
|
|
@ -33,4 +33,9 @@ class SayHello implements ShouldQueue
|
|||
echo 'Hello, from ', __CLASS__, PHP_EOL;
|
||||
passthru ('sleep 10; echo Hello, from echo in ' . escapeshellarg(__CLASS__));
|
||||
}
|
||||
|
||||
public function getPriority(): ?int
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue