RabbitMQ的HTTP API文档中给出了/API/connections/name可以用来删除连接。但是curl -i -u guest:guest -X "DELETE" http://localhost:15672/api/connections/ --data-urlencode "${conn_name}"
给出:
HTTP/1.1 405 Method Not Allowed
allow: HEAD, GET, OPTIONS
content-length: 0
date: Wed, 12 Dec 2018 16:54:48 GMT
server: Cowboy
vary: origin
然而,GET正在工作。curl -i -u guest:guest -X GET http://localhost:15672/api/connections/ --data-urlencode "${conn_name}"
给出
HTTP/1.1 200 OK
cache-control: no-cache
content-length: 1175
content-type: application/json
date: Wed, 12 Dec 2018 16:48:32 GMT
server: Cowboy
vary: accept, accept-encoding, origin
[{"auth_mechanism":"PLAIN",...
1条答案
按热度按时间fkaflof61#
请仔细重新阅读
/api/connections
和DELETE
的API documentation。您会注意到此操作的正确URI是/api/connections/name
,其中name
是您的连接的名称。curl
的--data-urlencode
选项主要用于POST
请求(但请参见-G
curl
选项)。您的GET
请求实际上返回了所有连接。所以,如果你的连接名是“My RabbitMQ Connection”,你首先需要对其进行URL编码,并创建正确的URI: