To prevent a user from having to wait for a time consuming task to complete in a web request the system needs to be able to start asynchronous background tasks and return the response to the user without waiting for the task to complete. Some examples when this kind of background processing is required are:
In our solutions we usually exchange data with different types of systems and it is quite common that this is done on a schedules basis. Some examples when this kind of background processing is required are:
The component we currently are using at Vertica to be able to execute background tasks in our applications is called Hangfire. The projects web page is found here.
Hangfire is an open-source framework that helps you to create, process and manage your background jobs, i.e. operations you don't want to put in your request processing pipeline and it is available as an NuGet package for both the .NET Standard and Core framework.
The module consists of three main components: client, storage and server.
Hangfire can both be hosted in your web application or in a console application. In an Azure context we often use continuous Azure WebJob:s to run the Hangfire background worker in a console application. This approach separates the background processing from the web application and heavy background processing does not affect the wp3 process. Another approach is to host the WebJob in its own app service to separate the background processing from the web application even more.