Indrivo.BackgroundProcessor.Utility.Contracts 1.0.1

There is a newer version of this package available.
See the version list below for details.
dotnet add package Indrivo.BackgroundProcessor.Utility.Contracts --version 1.0.1                
NuGet\Install-Package Indrivo.BackgroundProcessor.Utility.Contracts -Version 1.0.1                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Indrivo.BackgroundProcessor.Utility.Contracts" Version="1.0.1" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Indrivo.BackgroundProcessor.Utility.Contracts --version 1.0.1                
#r "nuget: Indrivo.BackgroundProcessor.Utility.Contracts, 1.0.1"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Indrivo.BackgroundProcessor.Utility.Contracts as a Cake Addin
#addin nuget:?package=Indrivo.BackgroundProcessor.Utility.Contracts&version=1.0.1

// Install Indrivo.BackgroundProcessor.Utility.Contracts as a Cake Tool
#tool nuget:?package=Indrivo.BackgroundProcessor.Utility.Contracts&version=1.0.1                

Background Processing

Introduction

During the development of multiple solutions @Indrivo we have ussually encoutered the need of having a background or ASYNCHRONOUS process that runs on different triggers like : cron expression, http trigger, message that came via a message bus etc. .NET Core comes with a basic functionality that covers the need of a background worker to some extent, however that is most often not enough and is pretty uncomfortable to develop and monitor.

Purpose

The main purpose of the module came from the need of a having MediatR run specific commands (long running requests) in the background asynchronously, known under the term Fire-and-Forget processes. As well the administrators would need to have a monitoring dashboard built on top of the functionality. Seamless integration and extension of MediatR functionality is desired. In time the module developed a way to run CRON jobs in a simillar fashion. So the main functionality right now consists of:

  1. MediatR extension method for ASYNC processing -- .Enqueue();
  2. Easy to use CRON job setup that can be integrated in projects that run with/without MediatR.
  3. Monitoring dashboard for easier debugging and resolving of issues.

How to set up

A reference web api is already set up in the current repository you can check that one for detailed implementation information. Below only a small set of nuances will be explained. Set up is pretty straightforward you will need to install the following packages inside your solution:

  1. Indrivo.BackgroundProcessor.Utility.Contracts
  2. Indrivo.BackgroundProcessor.Utility.Service.Hangfire
  3. Indrivo.BackgroundProcessor.Utility.Service.Hangfire.PostgreSQL.Plugin
  4. Indrivo.BackgroundProcessor.Utility.Service.Hangfire.SQLServer.Plugin

Each plugin comes with his own small installer. So you are free to use them explicitly. However the desired way is to add the following structure to your appsetting file. Example:

  "HangfireConfigurationOptions": {
    "DatabaseProvider": "SQLServer",
    "DatabaseConnectionString": "Server=(localdb)\\mssqllocaldb;Database=aspnet-hangfireTest;Trusted_Connection=True;MultipleActiveResultSets=true"
  }

Where the DatabaseProvider can be either of the : "SQLServer" | "PostregSQL".

Example of this setup can be seen in the reference web application present in the current repo.

Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (2)

Showing the top 2 NuGet packages that depend on Indrivo.BackgroundProcessor.Utility.Contracts:

Package Downloads
Indrivo.BackgroundProcessor.Utility.Service.Hangfire

Package Description

Indrivo.Notifications.Engine

Package Description

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.3 2,035 4/18/2023
1.0.2 1,034 12/6/2022
1.0.1 853 12/6/2022
1.0.0 889 6/7/2022