Azure Service Bus - Receive messages continuously

Viewed 38

I want to move from Microsoft.Azure.ServiceBus library to Azure.Messaging.ServiceBus library, because this one is more actual. I have problem in my Rest Api (.NET) where I need to continously receive messages from Service Bus queue.

In previous library there was a Method RegisterMessageHandler(Func<Message,CancellationToken,Task>, MessageHandlerOptions) https://docs.microsoft.com/en-us/dotnet/api/microsoft.azure.servicebus.queueclient.registermessagehandler?view=azure-dotnet

that worked just fine for me. In new library (Azure.Messaging.ServiceBus) I can't find one to do same thing.

Anyone has an idea how to solve this? And I don't mean going back to previous library ;)

1 Answers

There's an equivalent in the Azure.Messaging.ServiceBus SDK called ServiceBusProcessor. See this example how to use it.

Related