简体   繁体   English

获取排队的工作总数laravel — RabbitMQ

[英]get total number of queued jobs laravel — RabbitMQ

new to Laravel , I'm using RabbitMQ with it, So, what I want is to get total number of queued jobs in some specific queue . LaravelLaravel ,我正在使用RabbitMQ ,所以,我想要的是获取某个特定queue中已queued jobs总数。

here are my connection details 这是我的联系方式

RABBITMQ_HOST=Server
RABBITMQ_PORT=5672
RABBITMQ_VHOST=/
RABBITMQ_LOGIN=user
RABBITMQ_PASSWORD=password
RABBITMQ_QUEUE=testQueue
RABBITMQ_EXCHANGE_NAME=testExchnge

any clue, or pointing to some tutorial to get total queued jobs. 任何线索,或指向一些教程以获得排队的工作总数。

Thanks 谢谢

for any other, who is looking for the same thing, found a solution. 对于寻找相同事物的任何其他人,找到了解决方案。 Hope this will help. 希望这会有所帮助。

I found the nice Rrabbit MQ HTTP API . 我找到了不错的Rrabbit MQ HTTP API There are a lot of endpoints there. 那里有很多端点。

To get the messages from Queues , here is my code. 要从Queues获得消息,这是我的代码。

//laravel[lumen] based code.
public function loadQueueStats()
{
    $url = "http://" . env('RABBITMQ_HOST', '127.0.0.1') . ":" . env('RABBITMQ_PORT', 15672) . "/api/queues";
    $username = env('RABBITMQ_LOGIN', 'guest');
    $password = env('RABBITMQ_PASSWORD', 'guest');
    $response = $this->guzzle->get(
        $url,
        [
            'auth' => [
                $username,
                $password
            ],
        ]
    );
    return $response->json();
}

But What about the get a specific queue? 但是,获得特定队列呢?

Like; 喜欢; /api/queues/vhost/name/get / api / queues / vhost / name / get

It is accepted parameters following; 以下是可接受的参数;

{"count":5,"ackmode":"ack_requeue_true","encoding":"auto","truncate":50000}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM