Skip to content

Commit 450aa52

Browse files
author
Hubert Plociniczak
committed
Added missing connection close/abort methods
1 parent 34e37e2 commit 450aa52

File tree

2 files changed

+82
-7
lines changed

2 files changed

+82
-7
lines changed

src/client/api/IConnection.cs

Lines changed: 63 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,20 @@ public interface IConnection: IDisposable
169169
///</remarks>
170170
void Close();
171171

172+
///<summary>Close this connection and all its channels.</summary>
173+
///<remarks>
174+
///The method behaves in the same way as Close(), with the only
175+
///difference that the connection is closed with the given connection
176+
///close code and message.
177+
///<para>
178+
///The close code (See under "Reply Codes" in the AMQP specification)
179+
///</para>
180+
///<para>
181+
///A message indicating the reason for closing the connection
182+
///</para>
183+
///</remarks>
184+
void Close(ushort reasonCode, string reasonText);
185+
172186
///<summary>Close this connection and all its channels
173187
///and wait with a timeout for all the in-progress close operations
174188
///to complete.
@@ -189,6 +203,23 @@ public interface IConnection: IDisposable
189203
///</remarks>
190204
void Close(int timeout);
191205

206+
///<summary>Close this connection and all its channels
207+
///and wait with a timeout for all the in-progress close operations
208+
///to complete.
209+
///</summary>
210+
///<remarks>
211+
///The method behaves in the same way as Close(int timeout), with the only
212+
///difference that the connection is closed with the given connection
213+
///close code and message.
214+
///<para>
215+
///The close code (See under "Reply Codes" in the AMQP specification)
216+
///</para>
217+
///<para>
218+
///A message indicating the reason for closing the connection
219+
///</para>
220+
///</remarks>
221+
void Close(ushort reasonCode, string reasonText, int timeout);
222+
192223
///<summary>Abort this connection and all its channels.</summary>
193224
///<remarks>
194225
///Note that all active channels, sessions, and models will be
@@ -200,10 +231,24 @@ public interface IConnection: IDisposable
200231
///</remarks>
201232
void Abort();
202233

234+
///<summary>Abort this connection and all its channels.</summary>
235+
///<remarks>
236+
///The method behaves in the same way as Abort(), with the only
237+
///difference that the connection is closed with the given connection
238+
///close code and message.
239+
///<para>
240+
///The close code (See under "Reply Codes" in the AMQP specification)
241+
///</para>
242+
///<para>
243+
///A message indicating the reason for closing the connection
244+
///</para>
245+
///</remarks>
246+
void Abort(ushort reasonCode, string reasonText);
247+
203248
///<summary>
204249
///Abort this connection and all its channels and wait with a
205250
///timeout for all the in-progress close operations to complete.
206-
///.</summary>
251+
///</summary>
207252
///<remarks>
208253
///This method, behaves in a similar way as method Abort() with the
209254
///only difference that it explictly specifies the timeout given
@@ -217,6 +262,23 @@ public interface IConnection: IDisposable
217262
///</remarks>
218263
void Abort(int timeout);
219264

265+
///<summary>
266+
///Abort this connection and all its channels and wait with a
267+
///timeout for all the in-progress close operations to complete.
268+
///</summary>
269+
///<remarks>
270+
///The method behaves in the same way as Abort(timeout), with the only
271+
///difference that the connection is closed with the given connection
272+
///close code and message.
273+
///<para>
274+
///The close code (See under "Reply Codes" in the AMQP specification)
275+
///</para>
276+
///<para>
277+
///A message indicating the reason for closing the connection
278+
///</para>
279+
///</remarks>
280+
void Abort(ushort reasonCode, string reasonText, int timeout);
281+
220282
///<summary>Returns the list of ShutdownReportEntry objects that
221283
///contain information about any errors reported while closing the
222284
///connection in the order they appeared</summary>

src/client/impl/ConnectionBase.cs

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -353,35 +353,48 @@ public void Close()
353353
Close(200, "Goodbye", Timeout.Infinite);
354354
}
355355

356+
///<summary>API-side invocation of connection close.</summary>
357+
public void Close(ushort reasonCode, string reasonText)
358+
{
359+
Close(reasonCode, reasonText, Timeout.Infinite);
360+
}
361+
356362
///<summary>API-side invocation of connection close with timeout.</summary>
357363
public void Close(int timeout)
358364
{
359365
Close(200, "Goodbye", timeout);
360366
}
361-
362-
public void Close(ShutdownEventArgs reason)
363-
{
364-
Close(reason, false, Timeout.Infinite);
365-
}
366367

368+
///<summary>API-side invocation of connection close with timeout.</summary>
367369
public void Close(ushort reasonCode, string reasonText, int timeout)
368370
{
369371
Close(new ShutdownEventArgs(ShutdownInitiator.Application, reasonCode, reasonText), false, timeout);
370372
}
371-
373+
374+
public void Close(ShutdownEventArgs reason)
375+
{
376+
Close(reason, false, Timeout.Infinite);
377+
}
372378

373379
///<summary>API-side invocation of connection abort.</summary>
374380
public void Abort()
375381
{
376382
Abort(Timeout.Infinite);
377383
}
384+
385+
///<summary>API-side invocation of connection abort.</summary>
386+
public void Abort(ushort reasonCode, string reasonText)
387+
{
388+
Abort(reasonCode, reasonText, Timeout.Infinite);
389+
}
378390

379391
///<summary>API-side invocation of connection abort with timeout.</summary>
380392
public void Abort(int timeout)
381393
{
382394
Abort(200, "Connection close forced", timeout);
383395
}
384396

397+
///<summary>API-side invocation of connection abort with timeout.</summary>
385398
public void Abort(ushort reasonCode, string reasonText, int timeout)
386399
{
387400
Abort(reasonCode, reasonText, ShutdownInitiator.Application, timeout);

0 commit comments

Comments
 (0)