出于故障排除的目的,我希望获得将消息发送到特定队列或交换的生产者的列表。我在rabbitmq控制台中看不到任何获取上述详细信息的选项。一些生产者正在堆积一个零散的队列,我正在尝试找出生产者在队列中堆积消息的IP。
有人能在这方面给我指点一下吗?
发布于 2018-11-02 21:42:38
默认情况下,您没有此信息,但您可以使用消息标头来执行此操作。
例如:
string message = "Hello World!";
var body = Encoding.UTF8.GetBytes(message);
var properties = new BasicProperties();
properties.Headers = new Dictionary<string, object>();
properties.Headers.Add("senderip", InetAddress.getLocalHost().getHostAddress());
properties.Headers.Add("custominfo", "info" );
channel.BasicPublish(exchange: "", routingKey: "mykey", basicProperties: properties,body: body);当您检索到消息时,您可以解码邮件头
https://stackoverflow.com/questions/53112471
复制相似问题