Rafael Gouveia
Rafael Gouveia

Reputation: 21

Retrieve arguments and attributes of a queue in RabbitMQ

In the REST API of the RabbitMQ you can get various information of an existing queue (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"
}

But with the Spring-AMQP or RabbitMQ-client for Java, it seems impossible.

For example, something like this:

rabbitAdmin.getQueueInformation ("queueName")

or

channel.queueInformation ("queueName")

Upvotes: 2

Views: 2527

Answers (1)

Gary Russell
Gary Russell

Reputation: 174554

Spring-AMQP and the rabbit client are for the runtime AMQP protocol; you can use Spring's RestTemplate to access the ReST API; it has built-in jackson support to convert the JSON.

At a higher level, you can use Spring Integration's http:outbound-gateway.

Upvotes: 1

Related Questions