Search code examples
azureazureservicebusazure-servicebus-queuesazure-servicebus-topics

How do I run an Azure Service Bus Topics subscriber app 24/7 in Azure?


There is an example here that explains on how to send messages and receive messages using Azure Service Bus through a publisher and subscriber application.

My questions are about the subscriber application that receives messages:

  1. Does registering in the application a message handler with subscriptionClient.RegisterMessageHandler(ProcessMessagesAsync, messageHandlerOptions); process the messages 24/7 until the application is shut down?
  2. Can I deploy the subscriber console app in Azure only through Docker Container? If I don't want to use containers, what is the other hosting option I have? I have done CI/CD pipeline to host a WebAPI in Azure App Services from Visual Studio 2019 before.

Solution

  • Does registering in the application a message handler with subscriptionClient.RegisterMessageHandler(ProcessMessagesAsync, messageHandlerOptions); process the messages 24/7 until the application is shut down?

    That's correct. That API is intended for the continuous flow of messages that needs to be processed.

    Can I deploy the subscriber console app in Azure only through Docker Container? If I don't want to use containers, what is the other hosting option I have?

    You can host continuously running Azure Service Bus processing using the following options:

    • Virtual Machine(s)
    • AKS/ACI
    • Service Fabric
    • Azure WebJobs (requires a WebApp)

    An alternative option would be to look into Azure Functions. While it doesn't run 24/7, it allows a reactive type of application.