@@ -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 )
@@ -97,6 +99,19 @@ public RabbitMQBinding(String hostname, int port, IProtocol protocol)
97
99
this . Port = port ;
98
100
}
99
101
102
+ /// <summary>
103
+ /// Uses the broker and protocol specified
104
+ /// </summary>
105
+ /// <param name="hostname">The hostname of the broker to connect to</param>
106
+ /// <param name="port">The port of the broker to connect to</param>
107
+ /// <param name="maxMessageSize">The largest allowable encoded message size</param>
108
+ /// <param name="protocol">The protocol version to use</param>
109
+ public RabbitMQBinding ( String hostname , int port , long maxMessageSize , IProtocol protocol )
110
+ : this ( hostname , port , protocol )
111
+ {
112
+ this . MaxMessageSize = maxMessageSize ;
113
+ }
114
+
100
115
/// <summary>
101
116
/// Uses the specified protocol. The broker must be set before use.
102
117
/// </summary>
@@ -117,6 +132,7 @@ public override BindingElementCollection CreateBindingElements()
117
132
m_transport . HostName = this . HostName ;
118
133
m_transport . Port = this . Port ;
119
134
m_transport . BrokerProtocol = this . BrokerProtocol ;
135
+ m_transport . MaxReceivedMessageSize = this . MaxMessageSize ;
120
136
BindingElementCollection elements = new BindingElementCollection ( ) ;
121
137
122
138
if ( m_transactionsEnabled )
@@ -145,12 +161,12 @@ private void Initialize()
145
161
m_session = new ReliableSessionBindingElement ( ) ;
146
162
m_compositeDuplex = new CompositeDuplexBindingElement ( ) ;
147
163
m_transactionFlow = new TransactionFlowBindingElement ( ) ;
148
-
164
+ m_maxMessageSize = 8192L ;
149
165
m_isInitialized = true ;
150
166
}
151
167
}
152
168
}
153
-
169
+
154
170
/// <summary>
155
171
/// Gets the scheme used by the binding, soap.amqp
156
172
/// </summary>
@@ -179,6 +195,16 @@ public int Port
179
195
set { m_port = value ; }
180
196
}
181
197
198
+ /// <summary>
199
+ /// Specifies the maximum encoded message size
200
+ /// </summary>
201
+ [ ConfigurationProperty ( "maxmessagesize" ) ]
202
+ public long MaxMessageSize
203
+ {
204
+ get { return m_maxMessageSize ; }
205
+ set { m_maxMessageSize = value ; }
206
+ }
207
+
182
208
/// <summary>
183
209
/// Specifies the version of the AMQP protocol that should be used to communicate with the broker
184
210
/// </summary>
@@ -205,7 +231,7 @@ public ReliableSession ReliableSession
205
231
}
206
232
207
233
/// <summary>
208
- /// Determines whether or not the TransactionFlowBindingElement will
234
+ /// Determines whether or not the TransactionFlowBindingElement will
209
235
/// be added to the channel stack
210
236
/// </summary>
211
237
public bool TransactionFlow
0 commit comments