diff --git a/projects/RabbitMQ.Client/PublicAPI.Shipped.txt b/projects/RabbitMQ.Client/PublicAPI.Shipped.txt index 3794aecb06..7283f7a413 100644 --- a/projects/RabbitMQ.Client/PublicAPI.Shipped.txt +++ b/projects/RabbitMQ.Client/PublicAPI.Shipped.txt @@ -852,7 +852,7 @@ virtual RabbitMQ.Client.TcpClientAdapter.ReceiveTimeout.set -> void ~RabbitMQ.Client.IChannel.BasicConsumeAsync(string queue, bool autoAck, string consumerTag, bool noLocal, bool exclusive, System.Collections.Generic.IDictionary arguments, RabbitMQ.Client.IAsyncBasicConsumer consumer, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task ~RabbitMQ.Client.IChannel.BasicGetAsync(string queue, bool autoAck, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask ~RabbitMQ.Client.IChannel.BasicQosAsync(uint prefetchSize, ushort prefetchCount, bool global, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task -~RabbitMQ.Client.IChannel.BasicRejectAsync(ulong deliveryTag, bool requeue, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task +~RabbitMQ.Client.IChannel.BasicRejectAsync(ulong deliveryTag, bool requeue, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask ~RabbitMQ.Client.IChannel.CloseAsync(RabbitMQ.Client.ShutdownEventArgs reason, bool abort, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task ~RabbitMQ.Client.IChannel.CloseAsync(ushort replyCode, string replyText, bool abort, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task ~RabbitMQ.Client.IChannel.ConfirmSelectAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task diff --git a/projects/RabbitMQ.Client/client/api/IChannel.cs b/projects/RabbitMQ.Client/client/api/IChannel.cs index 434c0c60c7..39415f6abc 100644 --- a/projects/RabbitMQ.Client/client/api/IChannel.cs +++ b/projects/RabbitMQ.Client/client/api/IChannel.cs @@ -242,7 +242,7 @@ Task BasicQosAsync(uint prefetchSize, ushort prefetchCount, bool global, /// The delivery tag. /// If set to true, requeue rejected messages. /// CancellationToken for this operation. - Task BasicRejectAsync(ulong deliveryTag, bool requeue, + ValueTask BasicRejectAsync(ulong deliveryTag, bool requeue, CancellationToken cancellationToken = default); /// diff --git a/projects/RabbitMQ.Client/client/framing/Channel.cs b/projects/RabbitMQ.Client/client/framing/Channel.cs index 4736181234..a54422ae2b 100644 --- a/projects/RabbitMQ.Client/client/framing/Channel.cs +++ b/projects/RabbitMQ.Client/client/framing/Channel.cs @@ -56,11 +56,11 @@ public override ValueTask BasicNackAsync(ulong deliveryTag, bool multiple, bool return ModelSendAsync(method, cancellationToken); } - public override Task BasicRejectAsync(ulong deliveryTag, bool requeue, + public override ValueTask BasicRejectAsync(ulong deliveryTag, bool requeue, CancellationToken cancellationToken) { var method = new BasicReject(deliveryTag, requeue); - return ModelSendAsync(method, cancellationToken).AsTask(); + return ModelSendAsync(method, cancellationToken); } /// diff --git a/projects/RabbitMQ.Client/client/impl/AutorecoveringChannel.cs b/projects/RabbitMQ.Client/client/impl/AutorecoveringChannel.cs index 87a68e18e1..5dd3047fb5 100644 --- a/projects/RabbitMQ.Client/client/impl/AutorecoveringChannel.cs +++ b/projects/RabbitMQ.Client/client/impl/AutorecoveringChannel.cs @@ -259,7 +259,7 @@ public ValueTask BasicAckAsync(ulong deliveryTag, bool multiple, CancellationTok public ValueTask BasicNackAsync(ulong deliveryTag, bool multiple, bool requeue, CancellationToken cancellationToken) => InnerChannel.BasicNackAsync(deliveryTag, multiple, requeue, cancellationToken); - public Task BasicRejectAsync(ulong deliveryTag, bool requeue, CancellationToken cancellationToken) + public ValueTask BasicRejectAsync(ulong deliveryTag, bool requeue, CancellationToken cancellationToken) => InnerChannel.BasicRejectAsync(deliveryTag, requeue, cancellationToken); public async Task BasicCancelAsync(string consumerTag, bool noWait, CancellationToken cancellationToken) diff --git a/projects/RabbitMQ.Client/client/impl/ChannelBase.cs b/projects/RabbitMQ.Client/client/impl/ChannelBase.cs index 979b0285e6..261fe2b3c9 100644 --- a/projects/RabbitMQ.Client/client/impl/ChannelBase.cs +++ b/projects/RabbitMQ.Client/client/impl/ChannelBase.cs @@ -832,7 +832,7 @@ public abstract ValueTask BasicAckAsync(ulong deliveryTag, bool multiple, public abstract ValueTask BasicNackAsync(ulong deliveryTag, bool multiple, bool requeue, CancellationToken cancellationToken); - public abstract Task BasicRejectAsync(ulong deliveryTag, bool requeue, + public abstract ValueTask BasicRejectAsync(ulong deliveryTag, bool requeue, CancellationToken cancellationToken); public async Task BasicCancelAsync(string consumerTag, bool noWait, diff --git a/projects/RabbitMQ.Client/client/impl/RecoveryAwareChannel.cs b/projects/RabbitMQ.Client/client/impl/RecoveryAwareChannel.cs index b2d44c824d..6eb456ffb2 100644 --- a/projects/RabbitMQ.Client/client/impl/RecoveryAwareChannel.cs +++ b/projects/RabbitMQ.Client/client/impl/RecoveryAwareChannel.cs @@ -91,7 +91,7 @@ public override ValueTask BasicNackAsync(ulong deliveryTag, bool multiple, bool } } - public override Task BasicRejectAsync(ulong deliveryTag, bool requeue, + public override ValueTask BasicRejectAsync(ulong deliveryTag, bool requeue, CancellationToken cancellationToken) { ulong realTag = deliveryTag - ActiveDeliveryTagOffset; @@ -101,7 +101,7 @@ public override Task BasicRejectAsync(ulong deliveryTag, bool requeue, } else { - return Task.CompletedTask; + return default; } } } diff --git a/projects/Test/Common/TestConnectionRecoveryBase.cs b/projects/Test/Common/TestConnectionRecoveryBase.cs index 19e403a49a..cf27d06d13 100644 --- a/projects/Test/Common/TestConnectionRecoveryBase.cs +++ b/projects/Test/Common/TestConnectionRecoveryBase.cs @@ -298,7 +298,7 @@ public RejectingBasicConsumer(IChannel channel, ushort totalMessageCount, TaskCo public override Task PostHandleDeliveryAsync(ulong deliveryTag) { - return Channel.BasicRejectAsync(deliveryTag, false); + return Channel.BasicRejectAsync(deliveryTag, false).AsTask(); } }