RabbitMQ Management API调用

2021-03-21 02:26

阅读:662

标签:back   image   null   avg   splay   queue   windows   policy   res   

RabbitMQ在运行时,偶尔会有一些死信,即消息未正常消费,造成消息积压在消息队列中, 一直卡住,重复循环消费原来的消息队列

那么就需要有一种机制,来查看RabbitMQ是否有消息未正常消费,从而让RabbitMQ消费端重新启动服务,让消息能顺利消费(例如让Windows Service重启等)

首先,查看RabbitMQ Manage的界面,可以看到,这里未应答的消息总数是0,在某些特定的情况下,有可能会出现未应答的消息的,所以需要进行检测

技术图片

 

 

RabbitMQ Management API文档地址:https://pulse.mozilla.org/api/

技术图片

 

我们这里使用的API是/api/queues/vhost/name

请记住,其中vhost参数使用提默认的 ,需要Encoding为%2F

技术图片

 

 

Postman中如下

权限部分使用Basic Auth,并输入RabbitMQ Management的用户名和密码

技术图片

 

返回的JSON如下

技术图片技术图片
{
    "consumer_details": [],
    "arguments": {},
    "auto_delete": false,
    "backing_queue_status": {
        "avg_ack_egress_rate": 0.0,
        "avg_ack_ingress_rate": 0.0,
        "avg_egress_rate": 0.0,
        "avg_ingress_rate": 0.0,
        "delta": [
            "delta",
            16384,
            57,
            0,
            98304
        ],
        "len": 61,
        "mode": "default",
        "next_seq_id": 98304,
        "q1": 0,
        "q2": 0,
        "q3": 3,
        "q4": 1,
        "target_ram_count": "infinity"
    },
    "consumer_utilisation": null,
    "consumers": 0,
    "deliveries": [],
    "durable": true,
    "effective_policy_definition": {},
    "exclusive": false,
    "exclusive_consumer_tag": null,
    "garbage_collection": {
        "fullsweep_after": 65535,
        "max_heap_size": 0,
        "min_bin_vheap_size": 46422,
        "min_heap_size": 233,
        "minor_gcs": 19
    },
    "head_message_timestamp": null,
    "idle_since": "2019-11-04 8:57:13",
    "incoming": [],
    "memory": 30772,
    "message_bytes": 20576,
    "message_bytes_paged_out": 0,
    "message_bytes_persistent": 20576,
    "message_bytes_ram": 1247,
    "message_bytes_ready": 20576,
    "message_bytes_unacknowledged": 0,
    "messages": 61,
    "messages_details": {
        "rate": 0.0
    },
    "messages_paged_out": 0,
    "messages_persistent": 61,
    "messages_ram": 4,
    "messages_ready": 61,
    "messages_ready_details": {
        "rate": 0.0
    },
    "messages_ready_ram": 4,
    "messages_unacknowledged": 0,
    "messages_unacknowledged_details": {
        "rate": 0.0
    },
    "messages_unacknowledged_ram": 0,
    "name": "SyncData.5c8f2d5c806f0b43fc4a7a5c",
    "node": "rabbit@rabbit",
    "operator_policy": null,
    "policy": null,
    "recoverable_slaves": null,
    "reductions": 107151,
    "reductions_details": {
        "rate": 0.0
    },
    "single_active_consumer_tag": null,
    "state": "running",
    "type": "classic",
    "vhost": "/"
}
View Code

 

其中Ready和Unacked的消息如下

技术图片

 

RabbitMQ Management API调用

标签:back   image   null   avg   splay   queue   windows   policy   res   

原文地址:https://www.cnblogs.com/weschen/p/11833835.html


评论


亲,登录后才可以留言!