且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Laravel如何在多租户应用程序中为每个租户管理不同的队列?

更新时间:2023-02-20 20:04:40

我创建了一个自定义命令 queue:work_stores,参数为{user_id}.

I created one custom command queue:work_stores with argument {user_id}.

哪个运行队列:使用参数--once = true

Which run queue:work with arguments --once=true

$this->call('queue:work', [
  "--once" => true,
  "database"
]);

一个标志,用于跟踪当前队列:work_stores是否正在运行.

One flag which track if the current queue:work_stores is running or not.

检查完整代码 https://gist.github.com/little-isaac/a6d70c82f372406f827fb3b399745c8e