Issue
I'm currently running into an issue where my e-mails are not queuing in Laravel 5.8.
I have run:
php artisan queue:table
php artisan migrate
php artisan config:clear
php artisan config:cache
Controller:
$when = now()->addMinutes(2);
$customer->notify((new CustomerOrderItemStatusNotification($orderItem))->delay($when));
.env:
BROADCAST_DRIVER=log
CACHE_DRIVER=file
QUEUE_CONNECTION=database
SESSION_DRIVER=file
SESSION_LIFETIME=120
queue.php:
'connections' => [
'sync' => [
'driver' => 'sync',
],
'database' => [
'driver' => 'database',
'table' => 'jobs',
'queue' => 'default',
'retry_after' => 90,
]
]
CustomerOrderItemStatusNotification:
use Illuminate\Bus\Queueable;
use Illuminate\Notifications\Notification;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Notifications\Messages\MailMessage;
class CustomerOrderItemStatusNotification extends Notification
{
use Queueable;
The issue is that it is sending this immediately rather than waiting two minutes nor is it storing anything in the 'jobs' table.
Solution
implement class to shouldQueue interface
use Illuminate\Contracts\Queue\ShouldQueue;
class CustomerOrderItemStatusNotification extends Notification implements ShouldQueue
{
use Queueable;
Answered By - Masood Khan
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.