code4it-dev / blog-comments

https://www.code4it.dev/
1 stars 0 forks source link

blog/azure-service-bus-introduction #12

Open utterances-bot opened 3 years ago

utterances-bot commented 3 years ago

Azure Service Bus and C# - an introduction - Code4IT

Azure Service bus is a message broker generally used for sharing messages between applications. In this article, we're gonna see an introduction to Azure Service Bus, and how to work with it with .NET and C#

https://www.code4it.dev/blog/azure-service-bus-introduction

ngreyes commented 3 years ago

This will process all messages that you are able to wait for (Console.ReadKey() or Thread.Sleep(1000)). I'm still trying to figure out how to read all messages already in the queue without having to specify a wait or in a synchronous manner.

bellons91 commented 3 years ago

With Console.ReadKey(), as used in the example, the console application remains up and running until you stop it. In the meanwhile, all the messages are being processed, because we are processing them with an event handler, not a "called" method.

_ordersProcessor.ProcessMessageAsync += PizzaItemMessageHandler;

The event handler listens for events and asynchronously performs the related operations as soon as something happens.