0
votes

From a controller, I dispatched a job to send a welcome email using

$this->dispatch(new SendWelcomeEmail($user));

In SendWelcomeEmail Job I'm doing

public function handle(Mailer $mailer)
{
    $mailer->send('emails.welcome', ['data' => 'data'], function ($m) {
        $m->from('[email protected]', 'Noreply');
        $m->to('[email protected]', 'xyz')->subject('Welcome');
    });
}

My .env file is configured to be

QUEUE_DRIVER=database
MAIL_DRIVER=smtp
MAIL_HOST=email-smtp.us-east-1.amazonaws.com
MAIL_PORT=587
MAIL_USERNAME=*access*
MAIL_PASSWORD=*key*
MAIL_ENCRYPTION=tls

Checked:

  • Database migrations - 'Jobs' tables
  • Ran the queue listener before job dispatch trigger using php artisan queue:listen

Problem: The jobs are loaded on to the 'jobs' table in the database but are not processed. But this works completely fine when I update the queue drive.

QUEUE_DRIVER=sync

What am i missing here?

1
The reason the sync driver works is because jobs are immediately processed with that driver set, there really is no interaction with a "queue" since its all synchronous. Did anything get logged out as far as exceptions? Timeouts? - user320487
Did you run php artisan queue:work - lewis4u
Yes - This was the error that got logged. - local.ERROR: exception 'ErrorException' with message 'stream_socket_enable_crypto(): SSL operation failed with code 1. OpenSSL Error messages: error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed' - Anand Naik B

1 Answers

0
votes

Does your job have the following traits on the class?

use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;

And implement:

ShouldQueue