我如何在 Azure 中 运行 Azure 服务总线主题订阅者应用程序 24/7?

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

有一个示例 here 解释了如何通过发布者和订阅者应用程序使用 Azure 服务总线发送和接收消息。

我的问题是关于接收消息的订户应用程序:

  1. 在应用程序中注册消息处理程序 subscriptionClient.RegisterMessageHandler(ProcessMessagesAsync, messageHandlerOptions); 是否会 24/7 全天候处理消息,直到应用程序关闭?
  2. 我能否仅通过 Docker 容器在 Azure 中部署订户控制台应用程序?如果我不想使用容器,我还有什么其他托管选项?我在 Visual Studio 2019 之前完成 CI/CD 管道以在 Azure App Services 中托管 WebAPI。

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

没错。 API 用于需要处理的连续消息流。

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?

您可以使用以下选项连续托管 运行ning Azure 服务总线处理:

  • 虚拟机
  • AKS/ACI
  • 服务结构
  • Azure WebJobs(需要 WebApp)

另一种选择是调查 Azure Functions。虽然它不是 运行 24/7,但它允许响应式应用程序。