Dhineshkumar
Dhineshkumar

Reputation: 119

How to find number of queues bound to a particular exchange in rabbitmq?

I am trying to implement the Publish/Subscribe model specified in the Rabbitmq Tutorials in java. The example provided there works fine. Now I want to modify it such a way that it restricts the number of clients accessing the Exchange.

When I looked into it I could find a command "rabbitmqctl list_bindings" to list the bounded queues, which is manual typing. Is there any way to do that programmatically? or Do we have any exchange function to return the number of queues bound to an exchange?

I could not find any,please help me, any help is appreciated.

Upvotes: 5

Views: 1409

Answers (1)

Gabriele Santomaggio
Gabriele Santomaggio

Reputation: 22712

you can use the management UI HTTP API, here you can find all the API

you can use the API /api/exchanges/{vhost}/{exchange_name}/bindings/source

for example:

http://localhost:15672/api/exchanges/%2F/Topic_test/bindings/source

you will get a json as result, somethings like:


[

    {
        "source": "Topic_test",
        "vhost": "/",
        "destination": "test_0",
        "destination_type": "queue",
        "routing_key": "",
        "arguments": { },
        "properties_key": "~"
    },
    {
        "source": "Topic_test",
        "vhost": "/",
        "destination": "test_1",
        "destination_type": "queue",
        "routing_key": "",
        "arguments": { },
        "properties_key": "~"
    },
    {
        "source": "Topic_test",
        "vhost": "/",
        "destination": "test_2",
        "destination_type": "queue",
        "routing_key": "",
        "arguments": { },
        "properties_key": "~"
    }
]

Upvotes: 4

Related Questions