@@ -56,9 +56,10 @@ public sealed class RabbitMQBinding : Binding
56
56
{
57
57
private String m_host ;
58
58
private int m_port ;
59
+ private long m_maxMessageSize ;
59
60
private IProtocol m_brokerProtocol ;
60
61
private CompositeDuplexBindingElement m_compositeDuplex ;
61
- private MessageEncodingBindingElement m_encoding ;
62
+ private TextMessageEncodingBindingElement m_encoding ;
62
63
private bool m_isInitialized ;
63
64
private bool m_oneWayOnly ;
64
65
private ReliableSessionBindingElement m_session ;
@@ -67,8 +68,8 @@ public sealed class RabbitMQBinding : Binding
67
68
private RabbitMQTransportBindingElement m_transport ;
68
69
69
70
/// <summary>
70
- /// Creates a new instance of the RabbitMQBinding class initialized
71
- /// to use the Protocols.DefaultProtocol. The broker must be set
71
+ /// Creates a new instance of the RabbitMQBinding class initialized
72
+ /// to use the Protocols.DefaultProtocol. The broker must be set
72
73
/// before use.
73
74
/// </summary>
74
75
public RabbitMQBinding ( )
@@ -79,7 +80,8 @@ public RabbitMQBinding()
79
80
/// Uses the default protocol and the broker specified by the given
80
81
/// Uri.
81
82
/// </summary>
82
- /// <param name="broker">The address of the broker to connect to</param>
83
+ /// <param name="hostname">The hostname of the broker to connect to</param>
84
+ /// <param name="port">The port of the broker to connect to</param>
83
85
public RabbitMQBinding ( String hostname , int port )
84
86
: this ( hostname , port , Protocols . DefaultProtocol )
85
87
{ }
@@ -88,7 +90,7 @@ public RabbitMQBinding(String hostname, int port)
88
90
/// Uses the broker and protocol specified
89
91
/// </summary>
90
92
/// <param name="hostname">The hostname of the broker to connect to</param>
91
- /// <param name="port">The port of the broker to connect to</param>
93
+ /// <param name="port">The port of the broker to connect to</param>
92
94
/// <param name="protocol">The protocol version to use</param>
93
95
public RabbitMQBinding ( String hostname , int port , IProtocol protocol )
94
96
: this ( protocol )
@@ -104,15 +106,21 @@ public RabbitMQBinding(String hostname, int port, IProtocol protocol)
104
106
/// <param name="port">The port of the broker to connect to</param>
105
107
/// <param name="username">The broker username to connect with</param>
106
108
/// <param name="password">The broker password to connect with</param>
109
+ /// <param name="virtualhost">The broker virtual host</param>
110
+ /// <param name="maxMessageSize">The largest allowable encoded message size</param>
107
111
/// <param name="protocol">The protocol version to use</param>
108
- public RabbitMQBinding ( String hostname , int port ,
109
- String username , String password , IProtocol protocol )
112
+ public RabbitMQBinding ( String hostname , int port ,
113
+ String username , String password , String virtualhost ,
114
+ long maxMessageSize , IProtocol protocol )
110
115
: this ( protocol )
111
116
{
112
117
this . HostName = hostname ;
113
118
this . Port = port ;
114
119
this . Transport . Username = username ;
115
120
this . Transport . Password = password ;
121
+ this . Transport . VirtualHost ;
122
+ this . MaxMessageSize = maxMessageSize ;
123
+
116
124
}
117
125
118
126
/// <summary>
@@ -135,6 +143,7 @@ public override BindingElementCollection CreateBindingElements()
135
143
m_transport . HostName = this . HostName ;
136
144
m_transport . Port = this . Port ;
137
145
m_transport . BrokerProtocol = this . BrokerProtocol ;
146
+ m_transport . MaxReceivedMessageSize = this . MaxMessageSize ;
138
147
BindingElementCollection elements = new BindingElementCollection ( ) ;
139
148
140
149
if ( m_transactionsEnabled )
@@ -163,12 +172,12 @@ private void Initialize()
163
172
m_session = new ReliableSessionBindingElement ( ) ;
164
173
m_compositeDuplex = new CompositeDuplexBindingElement ( ) ;
165
174
m_transactionFlow = new TransactionFlowBindingElement ( ) ;
166
-
175
+ m_maxMessageSize = 8192L ;
167
176
m_isInitialized = true ;
168
177
}
169
178
}
170
179
}
171
-
180
+
172
181
/// <summary>
173
182
/// Gets the scheme used by the binding, soap.amqp
174
183
/// </summary>
@@ -197,6 +206,16 @@ public int Port
197
206
set { m_port = value ; }
198
207
}
199
208
209
+ /// <summary>
210
+ /// Specifies the maximum encoded message size
211
+ /// </summary>
212
+ [ ConfigurationProperty ( "maxmessagesize" ) ]
213
+ public long MaxMessageSize
214
+ {
215
+ get { return m_maxMessageSize ; }
216
+ set { m_maxMessageSize = value ; }
217
+ }
218
+
200
219
/// <summary>
201
220
/// Specifies the version of the AMQP protocol that should be used to communicate with the broker
202
221
/// </summary>
@@ -223,7 +242,7 @@ public ReliableSession ReliableSession
223
242
}
224
243
225
244
/// <summary>
226
- /// Determines whether or not the TransactionFlowBindingElement will
245
+ /// Determines whether or not the TransactionFlowBindingElement will
227
246
/// be added to the channel stack
228
247
/// </summary>
229
248
public bool TransactionFlow
0 commit comments