简体   繁体   中英

php artisan queue not showing anything

I'm using laravel 5.0 and trying to set a queue for sending an email, I have created it and wrote code like. Queue::pushOn('emails', new SendEmail($user));
It's adding a row in the jobs table, then I'm running the following command

$ php artisan queue:listen

But it is not showing anything and not sending emails too.

Check out that you have in config/queue.php a connection with the name of emails because you are pushing to this queue with the method pushOn() . As a alternative, only push in the default queue using:

Queue::push(new SendEmail($user));

Be sure to try to:

config:clear
cache:clear
config:cache

And then:

php artisan queue:listen emails

Will listen for jobs in the emails queue.

Hay, I had this same issue, I had an error in my job code that's why it's stuck in queue:listen , to make sure there is no error in your job code.

you can put the following check in job handle() methfor the error.

public function handle()
{
  try{
   // your code here.
  } catch (\Exception $e) {
      dd($e->getMessage());
  }
}

then run.

$ php artisan queue:listen emails

Now, if there is an error in your code the error will display in the command line. Hope this can help you.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM