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 ?
After days of searching I found the answer, there's no
method/functionin Laravel 5.1 that can give us the number of queued jobs in IronMQ.But against IronMQ On-Premise API Reference give us a solution, it's a REST/HTTP API that allow us to query different requests using javascript to set/get all what we want from/to queue (Get Queue, Update Queue, List Queues ...) and from/to messages in every queue (Get Message by Id, Get all Messages, Clear Messages ...).
Example, if we want the number of messages in queue, we have just to Get Queue Info and peek the
sizefrom result.A Practical Example :
You can find your first base link inside the concerned queue in your project under Webhook URL case (see picture bellow) :
JS code :
Result :