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('noreply@gmail.com', 'Noreply');
$m->to('xyz@live.com', '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:
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?
Does your job have the following traits on the class?
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
And implement:
ShouldQueue
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.