I am using Laravel 5.4 with an SQS Fifo Queue.
I can't seem to be able to get it working with my SQS Fifo Queue. To Queue my email job.
Can anyone with experience of this point me in the right direction for how to get laravel working with my SQS Fifo Queue.
This is my controller code to add the job to the queue:
(new ReferFriendEmail($referFriendObj))->onConnection('my_sqs_fifo');
This is the code of my job:
class ReferFriendEmail implements ShouldQueue
{
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
protected $referFriendObj = false;
/**
* Create a new job instance.
*
* @return void
*/
public function __construct($referFriendObj)
{
$this->referFriendObj = $referFriendObj;
}
/**
* Execute the job.
*
* @return void
*/
public function handle( )
{
$input = $this->referFriendObj->input;
Mail::send( 'emails.refer-a-friend',
[
'user' => $this->referFriendObj->from_user_info,
'first_name' => strtoupper( trim( $this->referFriendObj->from_user_info->first_name)),
'unique_link' => $this->referFriendObj->unique_link,
],
function ($m) use ( $input ) {
$m->from('[email protected]', 'Kuflink');
$m->to($input['to_email'], $input['to_email'] )->subject( "You've been referred to Kuflink by " . $input['first_name'] );
}
);
Email_user_referrer::where('email' , $input['to_email'])
->update(['flag_email_sent' => 1]);
}
}
It just seems nothing is going sqs. I am using it as the driver.
dispatch()
function on the job? – ceejayoz(new ReferFriendEmail($referFriendObj))->onConnection('my_sqs_fifo')
happens. Per the docs, it should bedispatch()
ed. – ceejayoz