php artisan queue:work command not working - php

I use queues and have a jobs table in database. jobs are inserted to jobs table but when enter "php artisan queue:work --queue=something" command nothing happens. I have another project which use the same .env file and same queue and it works correctly. I have tried php artisan config:clear but it is still the same. What is the problem?
PS C:\xampp\htdocs\deneme> php artisan queue:work
PHP Warning: Module "mysqli" is already loaded in Unknown on line 0
QUEUE_DRIVER=database

use queue connection, not queue driver.
QUEUE_CONNECTION=database

Related

In laravel job using database as queue connection. But queue:work command not triggering queues?

In Laravel job given queue connection as QUEUE_CONNECTION=database. when using QUEUE_CONNECTION=sync php artisan queue:work is running but when using QUEUE_CONNECTION=database queue is not triggering. php artisan queue:listen also not triggering the job.
You need to run
php artisan queue:restart
in one tab and another tab that is running
php artisan queue:work
Please run
php artisan queue:work --queue orders

How to execute laravel job (queue)?

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?
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.
Try
php artisan queue:listen
instead.
Yes there are times when your queue jobs won't run. For deployment if you are using redis queue driver, if not you can follow this here to install and configure redis and after which you should create a table for failed jobs using
php artisan queue:failed-table
php artisan migrate and then use php artisan queue:work redis --tries=3 --backoff=3 to retry every failed jobs 3 times after 3 seconds of failure.
To delay the next retry just add --delay=[NUM_OF_SECONDS] to your command.
For example, to wait 30 seconds to retry after failing just
run: php artisan queue:work tries=3 --delay=30
OR
php artisan queue:work --daemon --tries=3 --sleep=5 --delay=10

How do I remove old artisan command from Kernel in Laravel 5

I have created some Command files into my Laravel Application. Laravel version is 5.2. I set command like: get:email in the Command file. Also call the Command file into Kernel.php. After that I can see the artisan command list by typing the command php artisan list. as like as below:
//output
get:email
And I changed the command title get:email to get-bq:email. When I run the command php artisan get-bq:email -- its working nicely. Also I can see the list by typing the command php artisan list::
//output
get-bq:email
Issue / Problem: Both commands are working. But I won't to work with both of them. I have done the following things:
modified command file as well as command
run composer dump-autoload -o
run composer update
remove vendor and storage folder then run composer update again.
Still the old command is working into my system.
What I want: How May I remove my old commands from my Laravel(5.2) application?
Run these commands:
php artisan cache:clear
php artisan config:clear
These commands will clear app cache and config cache and recreate it.
I've had the same problem recently.
Repoeatedly tried
php artisan cache:clear
php artisan config:clear
and the cached Kernal command wouldn't clear.
In desperation i killed the queue worker terminal and restarted the queue with the command
php artisan queue:work
The issue stopped.

How to run 'php artisan queue:listen' on Openshift so that it runs every time someone uses the application?

I actually have a mailing system that I want to implement using queues in Laravel. Every time an order is placed, the customer should receive a mail.
I used
Mail::queue('mail.view',$data,function($message){
$message->to($email,$name)->subject('Order Confirmed.');
}
Then, I run php artisan queue:work to actually process the queue. How can I automate the work?
I'm using Openshift for hosting.
According to Laravel Coding, a way of doing this is
One is load up artisan queue:listen in the startup scripts of your server. This command automatically calls artisan queue:work when items appear in the queue.
How do I add artisan queue:listen to startup scripts?
Assuming you're using the OpenShift Laravel 5 QuickStart...
After line #91 in the .openshift/action_hooks/deploy file, add a call to artisan queue:listen:
php artisan migrate --force
php artisan queue:listen

Supervisord makes my Laravel queue:listen throw InvalidArgumentException

I'm having exactly the same issue as in the post here:
Laravel 4 Queue - [InvalidArgumentException] There are no commands defined in the "queue" namespace.
Centos 6.5 Final. Laravel 4.2, Supervisor 3.0 and Python 2.6.6
The config for the app:
[program:lvcartsey]
command=php artisan queue:listen --env="local"
stdout_logfile=/home/mike/web/app/storage/logs/myqueue_supervisord.log
redirect_stderr=true
directory=/home/mike/web
;autorestart=true
;autostart=true
user=mike
Once I start supervisor I get this in my myqueue_supervisord.log:
[InvalidArgumentException]
There are no commands defined in the "queue" namespace.
When run from the command line php artisan queue:listen works as expected.
I searched google, but I found no useful information regarding this issue. Anyone knows what might be the cause of this? How does running artisan from command line differ from supervisor running it?
See this answer. It's probably a fix for you too.
What you want to do is to change
command=php artisan queue:listen --env="local"
to
command=/usr/local/bin/php artisan queue:listen --env="local"

Categories