Skip to content

Commit

Permalink
Align Reject with Ack/Nack (#1642)
Browse files Browse the repository at this point in the history
Co-authored-by: Daniel Marbach <danielmarbach@users.noreply.github.com>
  • Loading branch information
danielmarbach and danielmarbach authored Jul 30, 2024
1 parent 36a16ba commit db5bc23
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion projects/RabbitMQ.Client/PublicAPI.Shipped.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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<string, object> arguments, RabbitMQ.Client.IAsyncBasicConsumer consumer, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task<string>
~RabbitMQ.Client.IChannel.BasicGetAsync(string queue, bool autoAck, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask<RabbitMQ.Client.BasicGetResult>
~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
Expand Down
2 changes: 1 addition & 1 deletion projects/RabbitMQ.Client/client/api/IChannel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ Task BasicQosAsync(uint prefetchSize, ushort prefetchCount, bool global,
/// <param name="deliveryTag">The delivery tag.</param>
/// <param name="requeue">If set to <c>true</c>, requeue rejected messages.</param>
/// <param name="cancellationToken">CancellationToken for this operation.</param>
Task BasicRejectAsync(ulong deliveryTag, bool requeue,
ValueTask BasicRejectAsync(ulong deliveryTag, bool requeue,
CancellationToken cancellationToken = default);

/// <summary>
Expand Down
4 changes: 2 additions & 2 deletions projects/RabbitMQ.Client/client/framing/Channel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion projects/RabbitMQ.Client/client/impl/ChannelBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions projects/RabbitMQ.Client/client/impl/RecoveryAwareChannel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -101,7 +101,7 @@ public override Task BasicRejectAsync(ulong deliveryTag, bool requeue,
}
else
{
return Task.CompletedTask;
return default;
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion projects/Test/Common/TestConnectionRecoveryBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
}

Expand Down

0 comments on commit db5bc23

Please sign in to comment.