Skip to content

Commit 3615d88

Browse files
committed
Restore CloseAsync that takes CancellationTokes so as to not break the API
1 parent 3dafe82 commit 3615d88

File tree

4 files changed

+25
-1
lines changed

4 files changed

+25
-1
lines changed

projects/RabbitMQ.Client/IChannel.cs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -265,6 +265,17 @@ Task CloseAsync(ushort replyCode, string replyText, bool abort,
265265
/// <returns></returns>
266266
Task CloseAsync(ShutdownEventArgs reason, bool abort);
267267

268+
/// <summary>
269+
/// Asynchronously close this session.
270+
/// </summary>
271+
/// <param name="reason">The <see cref="ShutdownEventArgs"/> instance containing the close data.</param>
272+
/// <param name="abort">Whether or not the close is an abort (ignoring certain exceptions).</param>
273+
/// <param name="cancellationToken">CancellationToken for this operation.</param>
274+
/// <returns></returns>
275+
[Obsolete("7.2.0 - cancellationToken is ignored")]
276+
Task CloseAsync(ShutdownEventArgs reason, bool abort,
277+
CancellationToken cancellationToken = default);
278+
268279
/// <summary>Asynchronously declare an exchange.</summary>
269280
/// <param name="exchange">The name of the exchange.</param>
270281
/// <param name="type">The type of the exchange.</param>

projects/RabbitMQ.Client/Impl/AutorecoveringChannel.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,12 @@ await _connection.DeleteRecordedChannelAsync(this,
234234
}
235235
}
236236

237+
public Task CloseAsync(ShutdownEventArgs args, bool abort,
238+
CancellationToken cancellationToken)
239+
{
240+
return CloseAsync(args, abort);
241+
}
242+
237243
public async Task CloseAsync(ShutdownEventArgs args, bool abort)
238244
{
239245
ThrowIfDisposed();

projects/RabbitMQ.Client/Impl/Channel.cs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,12 +205,18 @@ public Task CloseAsync(ushort replyCode, string replyText, bool abort,
205205
return CloseAsync(args, abort);
206206
}
207207

208+
public Task CloseAsync(ShutdownEventArgs args, bool abort,
209+
CancellationToken cancellationToken)
210+
{
211+
return CloseAsync(args, abort);
212+
}
213+
208214
public async Task CloseAsync(ShutdownEventArgs args, bool abort)
209215
{
210216
CancellationToken cancellationToken = args.CancellationToken;
211217

212218
bool enqueued = false;
213-
// We should really try to clsoe the connection and therefore we don't allow this to be canceled by the user
219+
// We should really try to close the channel and therefore we don't allow this to be canceled by the user
214220
var k = new ChannelCloseAsyncRpcContinuation(ContinuationTimeout, IsOpen ? CancellationToken.None : cancellationToken);
215221

216222
await _rpcSemaphore.WaitAsync(k.CancellationToken)

projects/RabbitMQ.Client/PublicAPI.Unshipped.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ RabbitMQ.Client.Exceptions.PublishReturnException.PublishReturnException(ulong p
55
RabbitMQ.Client.Exceptions.PublishReturnException.ReplyCode.get -> ushort
66
RabbitMQ.Client.Exceptions.PublishReturnException.ReplyText.get -> string!
77
RabbitMQ.Client.Exceptions.PublishReturnException.RoutingKey.get -> string!
8+
RabbitMQ.Client.IChannel.CloseAsync(RabbitMQ.Client.Events.ShutdownEventArgs! reason, bool abort, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task!
89
RabbitMQ.Client.RabbitMQTracingOptions
910
RabbitMQ.Client.RabbitMQTracingOptions.RabbitMQTracingOptions() -> void
1011
RabbitMQ.Client.RabbitMQTracingOptions.UsePublisherAsParent.get -> bool

0 commit comments

Comments
 (0)