How to dispatch a Job to a specific queue in Lumen 5.5

孤人 提交于 2019-12-07 03:55:45

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!