Search code examples
c#azureservicebusazure-webjobs

Azure WebJob Service bus nugget OnMessageAsync equivalent on version 3 for net core


I have a net core 2.2 project which need to use Microsoft.AzureWebJobs.ServiceBus package to handle queues. but on version 3 the method OnMessageAsync I was using disappeared. I changed version for compatibility.

I had a piece of code like this:

queueClient.OnMessageAsync(message=> Task.Factory.StartNew(new Action(()=> ProcessMessage(message))));

what's the equivalent method now?


Solution

  • The API is still there, just got renamed. It's now called RegisterMessageHandler and is still available via QueueClient. The article here demonstrates how to use the API.