我可以从我的 Python/kombu 客户端获取 RabbitMq 连接 ID 吗?
Can I get RabbitMq connection id from my Python/kombu client?
当我运行这个命令时:
rabbitmqctl list_connections pid
我得到如下输出:
<rabbit@my_box.2.1234.0>
<rabbit@my_box.2.1235.0>
有没有办法从我的 kombu 客户端读取这个 pid?
RabbitMQ 不会通过 AMQP 公开此类内部细节。
您可以使用 management plugin and its REST API 获取有关连接的许多信息。这是一个例子:
// JSON returned by http://localhost:15672/api/connections
// ...
{
"connected_at": 1458292870638,
"client_properties":
{
"product": "RabbitMQ",
"copyright": "Copyright (c) 2007-2016 Pivotal Software, Inc.",
"capabilities":
{
"exchange_exchange_bindings": true,
"connection.blocked": true,
"authentication_failure_close": true,
"basic.nack": true,
"publisher_confirms": true,
"consumer_cancel_notify": true
},
"information": "Licensed under the MPL. See http://www.rabbitmq.com/",
"version": "0.0.0",
"platform": "Java"
},
"channel_max": 0,
"frame_max": 131072,
"timeout": 60,
"vhost": "/",
"user": "guest",
"protocol": "AMQP 0-9-1",
"ssl_hash": null,
"ssl_cipher": null,
"ssl_key_exchange": null,
"ssl_protocol": null,
"auth_mechanism": "PLAIN",
"peer_cert_validity": null,
"peer_cert_issuer": null,
"peer_cert_subject": null,
"ssl": false,
"peer_host": "127.0.0.1",
"host": "127.0.0.1",
"peer_port": 54872,
"port": 5672,
"name": "127.0.0.1:54872 -> 127.0.0.1:5672",
"node": "rabbit@localhost",
"type": "network",
"channels": 1,
"state": "running",
"send_pend": 0,
"send_cnt": 108973,
"recv_cnt": 99426,
"recv_oct_details":
{
"rate": 288892.8
},
"recv_oct": 5540646,
"send_oct_details":
{
"rate": 1912389.8
},
"send_oct": 36669998
},
// ...
但是,PID 也不会通过此机制公开。
当我运行这个命令时:
rabbitmqctl list_connections pid
我得到如下输出:
<rabbit@my_box.2.1234.0>
<rabbit@my_box.2.1235.0>
有没有办法从我的 kombu 客户端读取这个 pid?
RabbitMQ 不会通过 AMQP 公开此类内部细节。
您可以使用 management plugin and its REST API 获取有关连接的许多信息。这是一个例子:
// JSON returned by http://localhost:15672/api/connections
// ...
{
"connected_at": 1458292870638,
"client_properties":
{
"product": "RabbitMQ",
"copyright": "Copyright (c) 2007-2016 Pivotal Software, Inc.",
"capabilities":
{
"exchange_exchange_bindings": true,
"connection.blocked": true,
"authentication_failure_close": true,
"basic.nack": true,
"publisher_confirms": true,
"consumer_cancel_notify": true
},
"information": "Licensed under the MPL. See http://www.rabbitmq.com/",
"version": "0.0.0",
"platform": "Java"
},
"channel_max": 0,
"frame_max": 131072,
"timeout": 60,
"vhost": "/",
"user": "guest",
"protocol": "AMQP 0-9-1",
"ssl_hash": null,
"ssl_cipher": null,
"ssl_key_exchange": null,
"ssl_protocol": null,
"auth_mechanism": "PLAIN",
"peer_cert_validity": null,
"peer_cert_issuer": null,
"peer_cert_subject": null,
"ssl": false,
"peer_host": "127.0.0.1",
"host": "127.0.0.1",
"peer_port": 54872,
"port": 5672,
"name": "127.0.0.1:54872 -> 127.0.0.1:5672",
"node": "rabbit@localhost",
"type": "network",
"channels": 1,
"state": "running",
"send_pend": 0,
"send_cnt": 108973,
"recv_cnt": 99426,
"recv_oct_details":
{
"rate": 288892.8
},
"recv_oct": 5540646,
"send_oct_details":
{
"rate": 1912389.8
},
"send_oct": 36669998
},
// ...
但是,PID 也不会通过此机制公开。