Anurag
Anurag

Reputation: 407

How to get rabbitmq federation link status using rabbitmq HTTP calls

Does some one know how can I get the status of the federation links using the RabbitMQ's HTTP APIs? I am able to get the definition of the federation upstream by the following example, but can't find a way to get its status.

Call - http://[hostname]:15672/api/parameters/federation-upstream returns me

[{"value":{"uri":["amqp://USER:PASSWORD@HOSTNAME:4003/VHOST"],"trust-user-id":false,"exchange":"anurag.fed"},"vhost":"VHOST","component":"federation-upstream","name":"upstream-fed"}]

The official documentation says, the link status can be monitored by rabbitmqctl or GUI, but it does not mention HTTP apis anywhere. Does this mean that rabbitmq does not have this capability in APIs? If it has can someone please help?

https://www.rabbitmq.com/federation-reference.html "You can monitor the status of federation links using rabbitmqctl and the management plugin."

RabbitMQ version being used: 3.6.8

Thanks, Anurag

Upvotes: 0

Views: 1864

Answers (2)

Luke Bakken
Luke Bakken

Reputation: 9627

The RabbitMQ management UI uses REST calls to fetch data, and you have the ability to trace those calls:

Enable the rabbitmq_federation_management plugin. Via the web UI, browse to the page showing the status you're looking for. Then, open the developer tools in your web browser to trace the network requests and responses. You will see requests to various /api REST resources - one of them will be what you can use in your application.

Upvotes: 1

Valentin S.
Valentin S.

Reputation: 504

You can call http://[hostname]:15672/api/federation-links which will retrieve a json which contains the status field, like this: [ { "node": "rabbit@hostname", "exchange": "exchange_name", "upstream_exchange": "exchange_name", "type": "exchange", "vhost": "/", "upstream": "upstream_name", "id": "blablabla", "status": "running", "local_connection": "<rabbit@hostname9>", "uri": "amqp://hostname:5672/%2f", "timestamp": "2019-03-15 13:57:57", }

Upvotes: 0

Related Questions