3 years ago

Queues Working Without Running `queue:listen`

Posted 3 years ago by gmanish

I just stated using madrill to send welcome emails to just registering users. I followed the official docs. Needless to say, setting everything up, was a cinch, really. Once I verified everything was working as expected, I decided to implement a job for sending the emails.

That too was a breeze. I'm using database driver and trying this in my homestead box. Here's what my Job's handle method looks like:

public function handle(Mailer $mailer)
        'emails.welcome', [
            'user' => $this->user
            $message->to($this->user->email, $this->user->name)
                    ->from('', 'Welcome')

                "Sent Welcome Email to: %s (%s)",

This is also working as expected. I receive the welcome email in seconds. What I don't understand is, it seems to be working even if I do not run php artisan queue:listen on my homestead box.

I've created the necessary database tables, using:

php artisan queue:failed-table

If I run php artisan queue:listen and watch the terminal, the mail arrives, but the message I'm trying to print from the handle function using var_dump never shows up in the console:

    "Sent Welcome Email to: %s (%s)",

Also, I do not see any entries in the jobs and failed_jobs table in my database.

Could someone shed a light on this please. I guess there's something crucial I'm missing.

Please sign in or create an account to participate in this conversation.