developers, I have a problem. My queue not working or i just not understand how it's works. I create a command which should add a new queue job. Driver for Queue is - database. After executing my command i see a new row in table 'jobs'. After that I try to do "php artisan queue:work" - but nothing happens.
Help me please, how can I execute this job?
Laravel queues provide a unified queueing API across a variety of different queue backends, such as Amazon SQS, Redis, or even a relational database. Laravel's queue configuration options are stored in your application's config/queue.php configuration file.
$this->mailer->queue($view, $data, function ($message) use ($toEmail, $toName, $subject) { $message ->to($toEmail, $toName) ->subject($subject); }); This will successfully run, but if the queue is not 'listening', the job gets pushed on to the job table, forever.
A job queue contains an ordered list of jobs waiting to be processed by a subsystem. The job queue is the first place that a submitted batch job goes before becoming active in a subsystem. The job is held here until a number of factors are met.
From the documentation : [Daemon Queue Listener] The queue:work
artisan command includes a --daemon
option for forcing the queue worker to continue processing jobs without ever re-booting the framework. This results in a significant reduction of CPU usage when compared to the queue:listen command:
To start a queue worker in daemon mode, use the --daemon
flag:
php artisan queue:work connection --daemon
However if you don't have multiple connections remove connection and execute it without connection :
php artisan queue:work --daemon
It worked for me.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With