【问题标题】:Naming queues in laravellaravel 中的队列命名
【发布时间】:2017-09-16 17:08:02
【问题描述】:

我有一个 Web 应用程序,我想让我们使用队列进行后台处理。阅读文档后,我似乎无法理解如何创建队列

到目前为止,我是这样理解的。

创建一个工作类来完成这项工作

php artisan make:job Background

向队列分派作业

$job = (new ProcessPodcast($podcast))->onQueue('processing');

        dispatch($job);

//This adds the job to the queue named processing

监听给定的队列

php artisan queue:listen --memory=512 --queue=processing

最后,有什么区别

php artisan make:job SendReminderEmail --queued  

php artisan make:job SendReminderEmail

如何使用我选择的名称创建队列?

【问题讨论】:

    标签: php laravel laravel-5


    【解决方案1】:

    -–queued 选项将确保该类实现 ShouldQueue 接口,因此当我们向该类分派作业时。

    【讨论】:

      猜你喜欢
      • 2013-10-04
      • 2018-11-20
      • 1970-01-01
      • 1970-01-01
      • 2015-03-21
      • 2011-07-07
      • 2021-02-01
      • 2022-10-25
      • 2016-12-04
      相关资源
      最近更新 更多