Skip to content

Commit

Permalink
fix: update ReceiptHandle after ChangeInvisibleDuration call
Browse files Browse the repository at this point in the history
Signed-off-by: Li Zhanhui <lizhanhui@gmail.com>
  • Loading branch information
lizhanhui committed May 28, 2024
1 parent 0149785 commit 39a7b35
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion csharp/rocketmq-client-csharp/MessageView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public class MessageView
private static readonly ILogger Logger = MqLogManager.CreateLogger<MessageView>();

internal readonly MessageQueue MessageQueue;
internal readonly string ReceiptHandle;
internal string ReceiptHandle;
private readonly long _offset;
private readonly bool _corrupted;

Expand Down
6 changes: 6 additions & 0 deletions csharp/rocketmq-client-csharp/SimpleConsumer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,12 @@ public async void ChangeInvisibleDuration(MessageView messageView, TimeSpan invi
var invocation = await ClientManager.ChangeInvisibleDuration(messageView.MessageQueue.Broker.Endpoints,
request, ClientConfig.RequestTimeout);
StatusChecker.Check(invocation.Response.Status, request, invocation.RequestId);

// ReceiptHandle might have been updated after its invisible duration is changed.
if (invocation.Response.Status.Code == Proto.Code.Ok)
{
messageView.ReceiptHandle = invocation.Response.ReceiptHandle;
}
}


Expand Down

0 comments on commit 39a7b35

Please sign in to comment.