framework: [5.1] [5.2] queue:listen and queue:work not working on windows

I can’t figure out why this is happening. I’m am running redis-cli monitor to check for output, and while calling $this->dispatch(JOB) works (I can see the job being RPUSHed), neither running php artisan queue:listen or php artisan queue:work appears to be doing anything in redis (no change in the monitored output).

There is no output for php artisan queue:work before it terminates (or for queue:listen before I terminate it).

I’ve tried specifying the connection with php artisan queue:listen/work redis but this doesn’t help either.

The above description was for redis, but using the database driver has the same issue. It’s inserted in the database correctly, but is never processed (attempts is always 0).

I tried upgrading to 5.2 but with the same result. I used php artisan make:job ClassName --queued in 5.1 to create the command. In 5.2 I’ve removed SelfHandling from the class as well.

One other thing to note, it works fine when I set QUEUE_DRIVER=sync in .env. The queue used is default (i.e. I didn’t specify a different queue).

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Comments: 55 (12 by maintainers)

Most upvoted comments

If you specified the connection or the queue when you add the job,you should run the listen or work command with connection and --queue,examples here: php artisan queue:listen database --queue emails

In my case php artisan queue:listen/work not worked while site in maintance mode https://laravel.com/docs/5.6/configuration#maintenance-mode

You need to be specific about which queue(s) your worker is going to process.

The default queue is called default. If you run php artisan queue:work it will only process the default queue. Laravel does not magically know what queues you want to use. So, if for example, you dispatched a job on the emails queue, then make sure to pass --queue=emails,default to the worker/listener command.

Although I would agree that the documentation could be clearer on this topic.

Same problem. Jobs are added to the jobs table but they are never excecuted

I did it!

Working example: artisan queue:work database --queue=emails

Required parameter: database and --queue

Same problem. Half of our dev team is on windows.

Reading all comments in this thread I find that it’s most probably an environment misconfiguration since many people report that it’s working or got it to work themselves. For that I’m closing this issue since I don’t see a point in keeping it since no laravel core changes would be applied.

I suggest that people visiting this thread later to read all the comments and make sure they applied all the suggestions.

It helped me.Thanks! I googled several hours. I used the command php artisan queue:listen --queue=your queue name(you can find it in your jobs table’s queue columne) after I found this.

You need to be specific about which queue(s) your worker is going to process.

The default queue is called default. If you run php artisan queue:work it will only process the default queue. Laravel does not magically know what queues you want to use. So, if for example, you dispatched a job on the emails queue, then make sure to pass --queue=emails,default to the worker/listener command.

Although I would agree that the documentation could be clearer on this topic.

@pmochine just like back in February, please check the following:

  • Trace what’s being executed when you run queue:work (using a remote debugger or dd(); in the code).
  • Whether you can manually see jobs in your queue driver.

Honestly, I just tested this:

  1. Install Laravel 5.2

    git clone https://github.com/laravel/laravel.git laravel52
    cd laravel52
    git checkout 5.2
    composer install
    composer require predis/predis
    cp .env.example .env
    php artisan key:generate
    
  2. Create a test job

    php artisan make:job TestQueue
    
  3. Edit app/Console/Commands/Inspire.php: add inside handle():

    dispatch(new \App\Jobs\TestQueue);
    

    Also, uncomment Commands\Inspire::class, in app/Console/Kernel.php.

  4. Edit app/Jobs/TestQueue.php: add inside handle():

    \Log::info('Hello from the queue');
    
  5. Run

    docker run --rm -p 6379:6379 -d redis
    php artisan inspire
    php artisan queue:work
    
  6. Check the log

    tail storage/logs/laravel.log
    

    Should show something like

    [2018-07-04 20:20:20] local.INFO: Hello from the queue
    

@themsaid It’s not a Bug, but there’s something missing. --queue parameters like optional but the default value is heavily assigned to ‘default’. https://github.com/laravel/framework/blob/5042846eb0bdd0ade2e760015b1e5c57013225d5/src/Illuminate/Queue/DatabaseQueue.php#L50

When people give this optional parameter they intentionally only want certain queues to run. At the same time, it is developing in order of priority. doc: https://laravel.com/docs/5.4/queues#queue-priorities expected: if a priorty is not specified, first in first out happening: run only default queue. Not exist default; people googling

laravel queue not working

Neded wildcard support and defalut queue name = “*” php artisan queue:work --queue=super,high,* 1. super 2. hing 3. other… php artisan queue:work run All queue

Having same issue, Laravel version=5.4 QUEUE_DRIVER=beanstalkd OS = MacOS

Also tried with redis

I get this in the log : local.ERROR: Predis\Response\ServerException: ERR unknown command ‘EVAL’ in C:\PROJECTS\blog\vendor\predis\predis\src\Client.php:370

windows 10 here 😃

Solved: Old version of redis-server. Updated and now it works

I just ran into the same issue, but I knew for sure it worked before… so I did some digging and found out that the queue:work command does not return ANY errors to the console. In my case I first did not have Redis running and after that there was a problem serializing a model, because a value was not available.

Both errors showed up on the laravel.log, but queue:work never told me anything.

Not sure if this helps anyone, but do check your laravel.log just in case it’s crapping out somewhere.