2

In .NET Framework Microsoft.ServiceBus.Messaging had a class used to receive messages from Service Bus, BrokeredMessage. However, in .NET Standard 2.0, in order to receive messages from a Service Bus, class Message is used, from Microsoft.Azure.ServiceBus.Core.

BrokeredMessage has a method, CompleteAsync(), used to complete the receive operation of a message and indicates that the message should be marked as processed and deleted. I can't find a method for the Message class that does the same thing. Do you guys know any solution in order to mark a message as processed and deleted for the Message class?

Robert
  • 57
  • 3
  • 10

1 Answers1

5

To complete the message in the Queue using Microsoft.Azure.ServiceBus.Core, there is a method CompleteAsync available in the QueueClient, through which the messages will be received.

The lock token of the message should be passed as the parameter for the CompleteAsync method.

Example: queueClient.CompleteAsync(message.SystemProperties.LockToken)

Arunprabhu
  • 1,454
  • 9
  • 15
  • I am not using queueClient, I am using MessageReceiver, which indeed has the CompleteAsync method. However, I have to first complete the receive operation by using a method like BrokeredMessage had, CompleteAsync, and after that call _messageReceiver.CompleteAsync(message.SystemProperties.LockToken). So, my question is how can I complete the receive operation of an object of the Message Class from Microsoft.Azure.ServiceBus.Core? Is there any method like CompleteAsync as for BrokeredMessage? – Robert Mar 20 '19 at 08:26
  • I don't think similar method is available in Message object. – Arunprabhu Mar 20 '19 at 09:41