问题
In standard a job I use this method to dispatch a Job:
dispatch(new PurchaseJob($trxId, $method, $params));
Next I want to dispatch another Job to send email, but I want to split it to another separate queue. From what I read on Laravel 5.5 docs I could do this:
SendEmailJob::dispatch($userEmail)->onQueue('send_email');
But it does not seems to work on Lumen 5.5.
What could I do to make this work or is there any other method that are not stated in the docs?
回答1:
I just managed to find a way to dispatch the queue with the specified name in Lumen 5.5.
public function toMail($notifiable)
{
$job = (new SendFriendRequestEmail($notifiable))->onQueue('email');
dispatch($job);
}
May be this article will help you understand more
来源:https://stackoverflow.com/questions/46648288/how-to-dispatch-a-job-to-a-specific-queue-in-lumen-5-5