Best Practices: On-Premises .NET Core App Checking Storage Queue for Messages

Mark Key 21 Reputation points
2022-05-23T19:53:09.053+00:00

I'm seeking best practices guidance for a .NET Core app, running on an on-premises server, that checks for messages in an Azure Storage Queue. When a message is detected, an action is performed on the on-premises server. (We do not want to use Azure Hybrid Connections.)

I have 2 working prototypes but don't know if either would be considered a best practice for this scenario.

  1. a locally-running Azure WebJob that handles a QueueTrigger
  2. a locally-running app with a BackgroundService that uses a QueueClient instance to check the queue for messages
    * I did consider a locally-running Azure Function, but all the documentation for the Core Tools suggests they're only for local testing and debugging.

Each of these approaches is running inside a Windows Service so they can be monitored to ensure they're running 24/7. Bearing in mind that the sole purpose of the on-premises app is to check for Azure Queue messages, do either of these 2 approaches appear to be sound? If not, can someone please advise on a best practice for this scenario?

ASP.NET Core
ASP.NET Core
A set of technologies in the .NET Framework for building web applications and XML web services.
4,207 questions
Azure Queue Storage
Azure Queue Storage
An Azure service that provides messaging queues in the cloud.
97 questions
.NET Runtime
.NET Runtime
.NET: Microsoft Technologies based on the .NET software framework.Runtime: An environment required to run apps that aren't compiled to machine language.
1,126 questions
Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
6,955 questions
0 comments No comments
{count} votes

Accepted answer
  1. Takahito Iwasa 4,841 Reputation points MVP
    2022-05-23T22:15:16.09+00:00

    Hi, @Mark Key

    You probably don't mind either.

    https://learn.microsoft.com/en-us/azure/azure-functions/functions-bindings-storage-queue-trigger?tabs=in-process%2Cextensionv5&pivots=programming-language-csharp#polling-algorithm

    According to the above, QueueTrigger's approach is also a polling model.
    Therefore, the mechanism is the same for both 1 and 2.

    If you are hosting with App Service, the Azure WebJob SDK will make the migration easier.

    1 person found this answer helpful.

1 additional answer

Sort by: Most helpful
  1. sadomovalex 3,626 Reputation points
    2022-05-24T14:27:09.853+00:00

    we use continuous web job which has QueueTrigger handler and it works both when deployed to Azure and from on-prem. Azure function also will work in both cases - we use that too. The only thing which you need to keep in mind is that on-prem server should allow Azure traffic through internet (may require firewall configuration).

    1 person found this answer helpful.