2

在 RabbitMQ 的 REST API 中,您可以获得现有队列的各种信息(http://rabbit.example.com:15672/api/queues/):

{
    "memory": 10888,
    "messages": 0,
    "messages_details": {
        "rate": 0
    },
    "messages_ready": 0,
    "messages_ready_details": {
        "rate": 0
    },
    "messages_unacknowledged": 0,
    "messages_unacknowledged_details": {
        "rate": 0
    },
    "idle_since": "2014-12-12 13:59:46",
    "policy": "",
    "exclusive_consumer_tag": "",
    "consumers": 0,
    "backing_queue_status": {
        "q1": 0,
        "q2": 0,
        "delta": [
            "delta",
            "undefined",
            0,
            "undefined"
        ],
        "q3": 0,
        "q4": 0,
        "len": 0,
        "pending_acks": 0,
        "target_ram_count": "infinity",
        "ram_msg_count": 0,
        "ram_ack_count": 0,
        "next_seq_id": 0,
        "persistent_count": 0,
        "avg_ingress_rate": 0,
        "avg_egress_rate": 0,
        "avg_ack_ingress_rate": 0,
        "avg_ack_egress_rate": 0
    },
    "status": "running",
    "name": "${sistemaConsumidor}.${domain}.${evento}.RetryQueue",
    "vhost": "/",
    "durable": true,
    "auto_delete": true,
    "arguments": {
        "x-dead-letter-exchange": "${exchangeType}.${domain}",
        "x-message-ttl": 5000,
        "x-dead-letter-routing-key": "${sistemaProdutor}.to.${sistemaConsumidor}.${domain}.${evento}"
    },
    "node": "rabbit@CI-41644-7"
}

但是对于 Java 的 Spring-AMQP 或 RabbitMQ-client,这似乎是不可能的。

例如,像这样:

rabbitAdmin.getQueueInformation ("queueName")

或者

channel.queueInformation ("queueName")
4

1 回答 1

1

Spring-AMQP 和 rabbit 客户端用于运行时 AMQP 协议;您可以使用 SpringRestTemplate访问 ReST API;它具有内置的杰克逊支持来转换 JSON。

在更高级别上,您可以使用 Spring Integration 的http:outbound-gateway

于 2014-12-12T19:03:45.770 回答