Skip to content

Commit 7517fc3

Browse files
author
Vlad Ionescu
committed
extra client properties can now be specifiec via ConnectionParameters
1 parent d2fdef3 commit 7517fc3

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

projects/client/RabbitMQ.Client/src/client/api/ConnectionParameters.cs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@
5555
//
5656
//---------------------------------------------------------------------------
5757
using System;
58+
using System.Collections;
5859

5960
namespace RabbitMQ.Client
6061
{
@@ -83,13 +84,18 @@ public class ConnectionParameters : ICloneable
8384
/// seconds, with zero meaning none (value: 0)</summary>
8485
public const ushort DefaultHeartbeat = 0; // PLEASE KEEP THIS MATCHING THE DOC ABOVE
8586

87+
/// <summary>Default extra client properties to be sent to the
88+
/// server (value: empty Hashtable)</summary>
89+
public static readonly IDictionary DefaultClientProperties = new Hashtable(); // PLEASE KEEP THIS MATCHING THE DOC ABOVE
90+
8691
private string m_userName = DefaultUser;
8792
private string m_password = DefaultPass;
8893
private string m_virtualHost = DefaultVHost;
8994
private ushort m_requestedChannelMax = DefaultChannelMax;
9095
private uint m_requestedFrameMax = DefaultFrameMax;
9196
private ushort m_requestedHeartbeat = DefaultHeartbeat;
9297
private SslOption m_ssl = new SslOption();
98+
private IDictionary m_clientProperties = DefaultClientProperties;
9399

94100
///<summary>Construct a fresh instance, with all fields set to
95101
///their respective defaults.</summary>
@@ -144,6 +150,13 @@ public SslOption Ssl
144150
set { m_ssl = value; }
145151
}
146152

153+
///<summary>Extra client properties to be sent to the server</summary>
154+
public IDictionary ClientProperties
155+
{
156+
get { return m_clientProperties; }
157+
set { m_clientProperties = value; }
158+
}
159+
147160
///<summary>Implement ICloneable.Clone by delegating to our type-safe variant.</summary>
148161
object ICloneable.Clone()
149162
{

projects/client/RabbitMQ.Client/src/client/impl/ConnectionBase.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -917,6 +917,10 @@ public IDictionary BuildClientPropertiesTable()
917917
"and Rabbit Technologies Ltd.");
918918
table["information"] = Encoding.UTF8.GetBytes("Licensed under the MPL. " +
919919
"See http://www.rabbitmq.com/");
920+
921+
foreach(DictionaryEntry de in Parameters.ClientProperties)
922+
table[de.Key] = de.Value;
923+
920924
return table;
921925
}
922926

0 commit comments

Comments
 (0)