for the #1 i think i found the answer https://saywebsolutions.com/blog/installing-supervisor-manage-laravel-queue-processes-ubuntu
Oct 11, 2021
2
Level 6
Queue Questions
1 - How do you make the queue work in production. Ex: AWS EC2 ? Do you create a cronjob that run php artisan queue:work every min?
2 I have SendReminder email function (see below) that works ok until I use "implements ShouldQueue". The moment I include "implements ShouldQueue" the variables that I send to a Transformer message function, stops working. Basically, the content of the email comes empty. However, if i don't use "implements ShouldQueue" the email content is delivery as expected.
<?php
namespace App\Mail;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Mail\Mailable;
use Illuminate\Queue\SerializesModels;
class SendReminder extends Mailable implements ShouldQueue
{
use Queueable, SerializesModels;
protected $booking;
public function __construct( $booking )
{
$this->booking = $booking;
}
public function build()
{
return $this->from( '[email protected]' )
->markdown('email.booking.reminder')
->subject( 'This is a reminder for event '. $this->booking->item->name )
->with('body', $this->transform( $this->booking ) ) ;
}
private function transform( $booking )
{
return \App\Transformers\NotificationTransform::body( $booking, $booking->body);
}
}
Please or to participate in this conversation.