Home » Php » database – What would prevent jobs in a queue from processing? [PHP / Laravel 5]

database – What would prevent jobs in a queue from processing? [PHP / Laravel 5]

Posted by: admin July 12, 2020 Leave a comment

Questions:

I have a queue I set up in Laravel 5 to delete companies and associated records. Each time this happens, a lot of work happens on the back-end, so queues are my best option.

I set up my config/queue.php file along with my .env file so that the database driver will be used. I am using the Queue::pushOn method to push jobs onto a queue called company_deletions. Ex.

Queue::pushOn('company_deletions', new CompanyDelete($id));

Where CompanyDelete is a command created with php artisan command:make CompanyDelete --queued

I have tried to get my queue to process using the following commands:

php artisan queue:work
php artisan queue:work company_deletions
php artisan queue:listen
php artisan queue:listen company_deletions
php artisan queue:work database
php artisan queue:listen database

Sometimes when looking at the output of the above commands, I get the following error:

[InvalidArgumentException]  
No connector for []  

Even when I don’t get an error I cannot get it to actually process the jobs for some reason. When I look in my jobs table, I can see the job on the queue, however the attempts column shows 0, reserved shows 0 and reserved_at is null. Am I missing some steps? I have looked over the documentation several times and cannot for the life of me figure out what is wrong. I don’t see anything in the laravel error logs either. What would prevent these jobs from being processed once they are in the jobs database? Any help is appreciated.

How to&Answers:

i run into a smiliar issue because i dont add the jobs in the default queue..

        $job = (new EmailJob(
            $this->a,
            $this->b,
            $this->c,
            $this->d,
            $e
        ))->onQueue('emails');

then i have to listen to the specific queue:

php artisan queue:listen --queue=emails

in your case it would be

php artisan queue:listen --queue=company_deletions