🗃️ Add priority to queue

This commit is contained in:
Dan Jones 2022-08-20 22:04:32 -05:00
commit 61f9cfb009
7 changed files with 171 additions and 2 deletions

View file

@ -0,0 +1,8 @@
<?php
namespace App\Jobs\Concerns;
interface HasPriority
{
public function getPriority(): ?int;
}

View file

@ -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;
}
}