【发布时间】:2015-10-03 08:13:03
【问题描述】:
在我的项目中使用 IronMQ 在 Laravel 5.1 中实现队列和作业,我现在可以将作业发送到 IronMQ 队列,如下图所示:
我现在想要的是在我的工作中的句柄函数中获取队列中的当前消息数量(红色框中的数字),找到下面的工作代码:
class GetWords extends Job implements SelfHandling, ShouldQueue{
use InteractsWithQueue, SerializesModels;
/**
* Create a new job instance.
*/
public function __construct(Url $url)
{
}
/**
* Execute the job.
*/
public function handle()
{
//getting the name of queue
dd($this->job->getName()); //return 'words'
$currentNumberMsgsInQueue = ?????; //i can't find how
//Condition
if($currentNumberMsgsInQueue == 10){
//Do something
}
}
}
问题是:如何使用 Laravel 获取 IronMQ 队列中排队作业(消息)的数量?
【问题讨论】:
标签: php laravel queue laravel-5.1 ironmq