Support the ongoing development of Laravel.io →
Queues
Last updated 1 month ago.
0

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"

0

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.

0

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();
0

Sign in to participate in this thread!

LaraJobs

Your banner here too?

g385700 g385700 g385700 Joined 15 Aug 2016

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

The Laravel portal for problem solving, knowledge sharing and community building.

© 2022 Laravel.io - All rights reserved.