Depending on the driver you are using you can see the contents of the queue. For example with the database driver it is a simple table and it has the details of the jobs "serialized". you could check those details.
But why do you want to check that? Avoid a job doing one thing twice? Maybe the job should do some validations when it runs and its not the queue that should be responsible of know what it has queued.
There are some packages out there like "queue monitor" or "queue checker"
I'm using beanstalk for queues.
I want to make sure that the same job (given the same parameter input) isn't already in the queue.
There is a workaround solution you can try to add below code before dispatch the queue
$queue = \DB::table(config('queue.connections.database.table'))->first();
if($queue){
$payload = json_decode($queue->payload,true);
if($payload['displayName'] == 'App\Jobs\ProcessReport'){
\flash('The report in process','info');
return back()->withInput();
}
}
//dispatch the queue
ProcessReport::dispatch();
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community