@@ -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 ( )
@@ -89,7 +90,7 @@ public RabbitMQBinding(String hostname, int port)
89
90
/// Uses the broker and protocol specified
90
91
/// </summary>
91
92
/// <param name="hostname">The hostname of the broker to connect to</param>
92
- /// <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>
93
94
/// <param name="protocol">The protocol version to use</param>
94
95
public RabbitMQBinding ( String hostname , int port , IProtocol protocol )
95
96
: this ( protocol )
@@ -105,15 +106,21 @@ public RabbitMQBinding(String hostname, int port, IProtocol protocol)
105
106
/// <param name="port">The port of the broker to connect to</param>
106
107
/// <param name="username">The broker username to connect with</param>
107
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>
108
111
/// <param name="protocol">The protocol version to use</param>
109
- public RabbitMQBinding ( String hostname , int port ,
110
- 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 )
111
115
: this ( protocol )
112
116
{
113
117
this . HostName = hostname ;
114
118
this . Port = port ;
115
119
this . Transport . Username = username ;
116
120
this . Transport . Password = password ;
121
+ this . Transport . VirtualHost = virtualhost ;
122
+ this . MaxMessageSize = maxMessageSize ;
123
+
117
124
}
118
125
119
126
/// <summary>
@@ -136,6 +143,7 @@ public override BindingElementCollection CreateBindingElements()
136
143
m_transport . HostName = this . HostName ;
137
144
m_transport . Port = this . Port ;
138
145
m_transport . BrokerProtocol = this . BrokerProtocol ;
146
+ m_transport . MaxReceivedMessageSize = this . MaxMessageSize ;
139
147
BindingElementCollection elements = new BindingElementCollection ( ) ;
140
148
141
149
if ( m_transactionsEnabled )
@@ -164,12 +172,12 @@ private void Initialize()
164
172
m_session = new ReliableSessionBindingElement ( ) ;
165
173
m_compositeDuplex = new CompositeDuplexBindingElement ( ) ;
166
174
m_transactionFlow = new TransactionFlowBindingElement ( ) ;
167
-
175
+ m_maxMessageSize = 8192L ;
168
176
m_isInitialized = true ;
169
177
}
170
178
}
171
179
}
172
-
180
+
173
181
/// <summary>
174
182
/// Gets the scheme used by the binding, soap.amqp
175
183
/// </summary>
@@ -198,6 +206,16 @@ public int Port
198
206
set { m_port = value ; }
199
207
}
200
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
+
201
219
/// <summary>
202
220
/// Specifies the version of the AMQP protocol that should be used to communicate with the broker
203
221
/// </summary>
@@ -224,7 +242,7 @@ public ReliableSession ReliableSession
224
242
}
225
243
226
244
/// <summary>
227
- /// Determines whether or not the TransactionFlowBindingElement will
245
+ /// Determines whether or not the TransactionFlowBindingElement will
228
246
/// be added to the channel stack
229
247
/// </summary>
230
248
public bool TransactionFlow
0 commit comments