Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get the queued job from job ID in Laravel?

Is there any way to get the queued job from the job ID in Laravel? While adding the job to the queue, I store the job ID. Later at some point of time (there is a delay to process the job in the queue), I want to remove the job from the queue. If I can get the job on the queue using the job ID, I can use delete() method to remove it.

like image 890
Debiprasad Avatar asked Oct 30 '16 12:10

Debiprasad


1 Answers

I use this code for laravel 5.5 :

use Illuminate\Contracts\Bus\Dispatcher;

$job = ( new JOB_CLASS() )->onQueue('QUEUE_NAME')->delay('DELAY');
$id  = app(Dispatcher::class)->dispatch($job);
like image 133
Armin Avatar answered Nov 07 '22 08:11

Armin