Implementing queues & jobs in Laravel 5.1 in my project using IronMQ, I can now send jobs to the IronMQ queue like you see in image bellow :
What I want now is to get the current number of messages in queue (number in red box) in the handle function in my job, find job code bellow :
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
}
}
}
Question is : How to get number of queued jobs (messages) in IronMQ queue using Laravel ?