I recently looked into this. I did a lot of googling before finding the simplest solution ever. using your ConnectionFactory
(or IConnectionFactory
) you invoke the method CreateConnection
in order to create a connection. This method takes a clientProvidedName
, this is the method and parameter you want to use. Reading comments around the internet this feature seems to have been added in RabbitMQ 3.6+. An example can be seen below:
ConnectionFactory factory = new ConnectionFactory();
factory.ClientProvidedName = "SomeConnectionName"
The clientProvidedName
is not unique and should not be used as a key or identification of any sort. It is simply a human friendly name for a connection. There is more information in the RabbitMQ documentation of ConnectionFactory.
At first I tried setting the name using ClientProperties (property named connection_name). But the RabbitMQ client reassigns this behind the scenes using the clientProvidedName
key in the ClientProperties (At least it did in the version I used).
The client for Java seems to have similar features.
I hope this helps someone, let me know in the comments if it did :)