如何api查询默认的vhost

gra*_*der 11 rabbitmq

RabbitMQ 文档说明:

Default Virtual Host and User

When the server first starts running, and detects that its database is uninitialised or has been deleted, it initialises a fresh database with the following resources:

a virtual host named /
Run Code Online (Sandbox Code Playgroud)

该API有类似的事情:

/api/exchanges/#vhost#/?name?/bindings
Run Code Online (Sandbox Code Playgroud)

哪个"?名字?" 是一个特定的交换名称.

但是,为默认的 -vhost #vhost#做了什么?

Gab*_*ele 17

正如写在这里:http://hg.rabbitmq.com/rabbitmq-management/raw-file/3646dee55e02/priv/www-api/help.html

由于默认虚拟主机名为"/",因此需要将其编码为"%2f".

所以:

/api/exchanges/%2f/{exchange_name}/bindings/source
Run Code Online (Sandbox Code Playgroud)

充分:

http://localhost:15672/api/exchanges/%2f/test_ex/bindings/source
Run Code Online (Sandbox Code Playgroud)

结果:

[{"source":"test_ex","vhost":"/","destination":"test_queue","destination_type":"queue","routing_key":"","arguments":{},"properties_key":"~"}]
Run Code Online (Sandbox Code Playgroud)

  • 对于出色的产品,这是一个真正尴尬的设计决定。作为消费者,您将只到这里并开始思考“ hmm,默认虚拟主机是斜杠字符,我必须在http url中使用它”,从而学习简单的真实答案,因此必须进行某种转义或编码“让我们用谷歌搜索”。非常感谢简单的事实。 (3认同)
  • Gaaaaaaaaaaaaaa!那是一直有的.谢谢. (2认同)