Skip to content

Commit 44ce7e2

Browse files
Merge default into bug25191
2 parents 9377b4b + 43d7c98 commit 44ce7e2

File tree

11 files changed

+492
-51
lines changed

11 files changed

+492
-51
lines changed

docs/specs/amqp0-9-1.stripped.xml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,15 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
167167
<chassis name="client" implement="MUST"/>
168168
<chassis name="server" implement="MUST"/>
169169
</method>
170+
<method name="blocked" index="60">
171+
<chassis name="server" implement="MUST"/>
172+
<chassis name="client" implement="MUST"/>
173+
<field name="reason" domain="shortstr" />
174+
</method>
175+
<method name="unblocked" index="61">
176+
<chassis name="server" implement="MUST"/>
177+
<chassis name="client" implement="MUST"/>
178+
</method>
170179
</class>
171180
<class name="channel" handler="channel" index="20">
172181
<chassis name="server" implement="MUST"/>

docs/specs/amqp0-9-1.xml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
exchange.bind and exchange.bind-ok,
88
exchange.unbind and exchange.unbind-ok,
99
basic.nack,
10+
connection.blocked and connection.unblocked,
1011
the ability for the Server to send basic.ack, basic.nack and
1112
basic.cancel to the client, and
1213
the un-deprecation of exchange.declare{auto-delete} and exchange.declare{internal}
@@ -893,6 +894,31 @@
893894
<chassis name = "client" implement = "MUST" />
894895
<chassis name = "server" implement = "MUST" />
895896
</method>
897+
898+
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
899+
900+
<method name = "blocked" index = "60" label = "indicates a connection is blocked">
901+
<doc>Notifies client that the connection is blocked</doc>
902+
903+
<field name = "reason" domain = "shortstr">
904+
<doc>
905+
Provides an explanation why the connection was blocked.
906+
</doc>
907+
</field>
908+
909+
<chassis name = "client" implement = "MUST" />
910+
<chassis name = "server" implement = "MUST" />
911+
</method>
912+
</class>
913+
914+
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
915+
916+
<method name = "unblocked" index = "61" label = "indicates a connection is unblocked">
917+
<doc>Notifies client that the connection is unblocked</doc>
918+
919+
<chassis name = "client" implement = "MUST" />
920+
<chassis name = "server" implement = "MUST" />
921+
</method>
896922
</class>
897923

898924
<!-- == CHANNEL ========================================================== -->

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

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,9 @@ public interface IConnection: IDisposable
7979
///</remarks>
8080
event CallbackExceptionEventHandler CallbackException;
8181

82+
event ConnectionBlockedEventHandler ConnectionBlocked;
83+
event ConnectionUnblockedEventHandler ConnectionUnblocked;
84+
8285
///<summary>Retrieve the endpoint this connection is connected
8386
///to.</summary>
8487
AmqpTcpEndpoint Endpoint { get; }
@@ -164,12 +167,12 @@ public interface IConnection: IDisposable
164167
///It can also throw IOException when socket was closed unexpectedly.
165168
///</remarks>
166169
void Close();
167-
170+
168171
///<summary>Close this connection and all its channels.</summary>
169172
///<remarks>
170173
///The method behaves in the same way as Close(), with the only
171174
///difference that the connection is closed with the given connection
172-
///close code and message.
175+
///close code and message.
173176
///<para>
174177
///The close code (See under "Reply Codes" in the AMQP specification)
175178
///</para>
@@ -178,15 +181,15 @@ public interface IConnection: IDisposable
178181
///</para>
179182
///</remarks>
180183
void Close(ushort reasonCode, string reasonText);
181-
184+
182185
///<summary>Close this connection and all its channels
183186
///and wait with a timeout for all the in-progress close operations
184187
///to complete.
185188
///</summary>
186189
///<remarks>
187190
///Note that all active channels, sessions, and models will be
188191
///closed if this method is called. It will wait for the in-progress
189-
///close operation to complete with a timeout. If the connection is
192+
///close operation to complete with a timeout. If the connection is
190193
///already closed (or closing), then this method will throw
191194
///AlreadyClosedException.
192195
///It can also throw IOException when socket was closed unexpectedly.
@@ -198,7 +201,7 @@ public interface IConnection: IDisposable
198201
///</para>
199202
///</remarks>
200203
void Close(int timeout);
201-
204+
202205
///<summary>Close this connection and all its channels
203206
///and wait with a timeout for all the in-progress close operations
204207
///to complete.
@@ -215,7 +218,7 @@ public interface IConnection: IDisposable
215218
///</para>
216219
///</remarks>
217220
void Close(ushort reasonCode, string reasonText, int timeout);
218-
221+
219222
///<summary>Abort this connection and all its channels.</summary>
220223
///<remarks>
221224
///Note that all active channels, sessions, and models will be
@@ -226,7 +229,7 @@ public interface IConnection: IDisposable
226229
///to complete.
227230
///</remarks>
228231
void Abort();
229-
232+
230233
///<summary>Abort this connection and all its channels.</summary>
231234
///<remarks>
232235
///The method behaves in the same way as Abort(), with the only
@@ -240,7 +243,7 @@ public interface IConnection: IDisposable
240243
///</para>
241244
///</remarks>
242245
void Abort(ushort reasonCode, string reasonText);
243-
246+
244247
///<summary>
245248
///Abort this connection and all its channels and wait with a
246249
///timeout for all the in-progress close operations to complete.
@@ -257,7 +260,7 @@ public interface IConnection: IDisposable
257260
///</para>
258261
///</remarks>
259262
void Abort(int timeout);
260-
263+
261264
///<summary>
262265
///Abort this connection and all its channels and wait with a
263266
///timeout for all the in-progress close operations to complete.
@@ -274,10 +277,17 @@ public interface IConnection: IDisposable
274277
///</para>
275278
///</remarks>
276279
void Abort(ushort reasonCode, string reasonText, int timeout);
277-
280+
278281
///<summary>Returns the list of ShutdownReportEntry objects that
279282
///contain information about any errors reported while closing the
280283
///connection in the order they appeared</summary>
281284
IList ShutdownReport { get; }
285+
286+
287+
///<summary>Handle incoming Connection.Blocked methods.</summary>
288+
void HandleConnectionBlocked(string reason);
289+
290+
///<summary>Handle incoming Connection.Unblocked methods.</summary>
291+
void HandleConnectionUnblocked();
282292
}
283293
}

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

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -537,7 +537,7 @@ BasicGetResult BasicGet(string queue,
537537
///</remarks>
538538
[AmqpMethodDoNotImplement(null)]
539539
void Close();
540-
540+
541541
///<summary>Close this session.</summary>
542542
///<remarks>
543543
///The method behaves in the same way as Close(), with the only
@@ -552,7 +552,7 @@ BasicGetResult BasicGet(string queue,
552552
///</remarks>
553553
[AmqpMethodDoNotImplement(null)]
554554
void Close(ushort replyCode, string replyText);
555-
555+
556556
///<summary>Abort this session.</summary>
557557
///<remarks>
558558
///If the session is already closed (or closing), then this
@@ -564,7 +564,7 @@ BasicGetResult BasicGet(string queue,
564564
///</remarks>
565565
[AmqpMethodDoNotImplement(null)]
566566
void Abort();
567-
567+
568568
///<summary>Abort this session.</summary>
569569
///<remarks>
570570
///The method behaves in the same way as Abort(), with the only
@@ -918,7 +918,7 @@ void HandleBasicNack(ulong deliveryTag,
918918
///Channel.Flow from the broker was processed.</summary>
919919
[AmqpMethodMapping(null, "channel", "flow-ok")]
920920
void _Private_ChannelFlowOk(bool active);
921-
921+
922922
///<summary>Handle incoming Channel.Flow methods. Either
923923
///stops or resumes sending the methods that have content.</summary>
924924
void HandleChannelFlow(bool active);
@@ -1017,6 +1017,20 @@ void HandleConnectionClose(ushort replyCode,
10171017
string replyText,
10181018
ushort classId,
10191019
ushort methodId);
1020+
1021+
///<summary>Handle an incoming Connection.Blocked.</summary>
1022+
[AmqpMethodMapping(null, "connection", "blocked")]
1023+
[AmqpUnsupported("RabbitMQ.Client.Framing.v0_8qpid")]
1024+
[AmqpUnsupported("RabbitMQ.Client.Framing.v0_8")]
1025+
[AmqpUnsupported("RabbitMQ.Client.Framing.v0_9")]
1026+
void HandleConnectionBlocked(string reason);
1027+
1028+
///<summary>Handle an incominga Connection.Unblocked.</summary>
1029+
[AmqpMethodMapping(null, "connection", "unblocked")]
1030+
[AmqpUnsupported("RabbitMQ.Client.Framing.v0_8qpid")]
1031+
[AmqpUnsupported("RabbitMQ.Client.Framing.v0_8")]
1032+
[AmqpUnsupported("RabbitMQ.Client.Framing.v0_9")]
1033+
void HandleConnectionUnblocked();
10201034
}
10211035

10221036
///<summary>Essential information from an incoming Connection.Tune
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
// This source code is dual-licensed under the Apache License, version
2+
// 2.0, and the Mozilla Public License, version 1.1.
3+
//
4+
// The APL v2.0:
5+
//
6+
//---------------------------------------------------------------------------
7+
// Copyright (C) 2007-2013 VMware, Inc.
8+
//
9+
// Licensed under the Apache License, Version 2.0 (the "License");
10+
// you may not use this file except in compliance with the License.
11+
// You may obtain a copy of the License at
12+
//
13+
// http://www.apache.org/licenses/LICENSE-2.0
14+
//
15+
// Unless required by applicable law or agreed to in writing, software
16+
// distributed under the License is distributed on an "AS IS" BASIS,
17+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18+
// See the License for the specific language governing permissions and
19+
// limitations under the License.
20+
//---------------------------------------------------------------------------
21+
//
22+
// The MPL v1.1:
23+
//
24+
//---------------------------------------------------------------------------
25+
// The contents of this file are subject to the Mozilla Public License
26+
// Version 1.1 (the "License"); you may not use this file except in
27+
// compliance with the License. You may obtain a copy of the License
28+
// at http://www.mozilla.org/MPL/
29+
//
30+
// Software distributed under the License is distributed on an "AS IS"
31+
// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
32+
// the License for the specific language governing rights and
33+
// limitations under the License.
34+
//
35+
// The Original Code is RabbitMQ.
36+
//
37+
// The Initial Developer of the Original Code is VMware, Inc.
38+
// Copyright (c) 2007-2013 VMware, Inc. All rights reserved.
39+
//---------------------------------------------------------------------------
40+
41+
42+
using System;
43+
44+
namespace RabbitMQ.Client.Events
45+
{
46+
47+
///<summary>Delegate used to process connection blocked events.</summary>
48+
public delegate void ConnectionBlockedEventHandler(IConnection sender, ConnectionBlockedEventArgs args);
49+
50+
///<summary>Event relating to connection being blocked</summary>
51+
public class ConnectionBlockedEventArgs : EventArgs
52+
{
53+
private readonly string m_reason;
54+
55+
public ConnectionBlockedEventArgs(string reason)
56+
{
57+
m_reason = reason;
58+
}
59+
60+
///<summary>Access the reason why connection is blocked</summary>
61+
public string Reason { get { return m_reason; } }
62+
}
63+
}
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
// This source code is dual-licensed under the Apache License, version
2+
// 2.0, and the Mozilla Public License, version 1.1.
3+
//
4+
// The APL v2.0:
5+
//
6+
//---------------------------------------------------------------------------
7+
// Copyright (C) 2007-2013 VMware, Inc.
8+
//
9+
// Licensed under the Apache License, Version 2.0 (the "License");
10+
// you may not use this file except in compliance with the License.
11+
// You may obtain a copy of the License at
12+
//
13+
// http://www.apache.org/licenses/LICENSE-2.0
14+
//
15+
// Unless required by applicable law or agreed to in writing, software
16+
// distributed under the License is distributed on an "AS IS" BASIS,
17+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18+
// See the License for the specific language governing permissions and
19+
// limitations under the License.
20+
//---------------------------------------------------------------------------
21+
//
22+
// The MPL v1.1:
23+
//
24+
//---------------------------------------------------------------------------
25+
// The contents of this file are subject to the Mozilla Public License
26+
// Version 1.1 (the "License"); you may not use this file except in
27+
// compliance with the License. You may obtain a copy of the License
28+
// at http://www.mozilla.org/MPL/
29+
//
30+
// Software distributed under the License is distributed on an "AS IS"
31+
// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
32+
// the License for the specific language governing rights and
33+
// limitations under the License.
34+
//
35+
// The Original Code is RabbitMQ.
36+
//
37+
// The Initial Developer of the Original Code is VMware, Inc.
38+
// Copyright (c) 2007-2013 VMware, Inc. All rights reserved.
39+
//---------------------------------------------------------------------------
40+
41+
42+
using System;
43+
44+
namespace RabbitMQ.Client.Events
45+
{
46+
47+
///<summary>Delegate used to process connection unblocked events.</summary>
48+
public delegate void ConnectionUnblockedEventHandler(IConnection sender);
49+
}

0 commit comments

Comments
 (0)