0

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://learn.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 ;)

maidey
  • 15
  • 3
  • Why are you not using [ServiceBusTrigger](https://learn.microsoft.com/en-us/azure/azure-functions/functions-bindings-service-bus-trigger?tabs=in-process%2Cextensionv5&pivots=programming-language-csharp)? – Markus Meyer Sep 15 '22 at 10:01
  • @MarkusMeyer - I meant Rest Api (my Function App reads from IotHub and, after calculation, sends data to Service Bus queue and there Rest Api should receive it) – maidey Sep 15 '22 at 10:10
  • ok, but it still makes more sense to me to use a ServiceBusTrigger – Markus Meyer Sep 15 '22 at 10:24

1 Answers1

0

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

Sean Feldman
  • 23,443
  • 7
  • 55
  • 80