Muonroi.BackgroundJobs.Quartz 1.0.0-alpha.16

This is a prerelease version of Muonroi.BackgroundJobs.Quartz.
dotnet add package Muonroi.BackgroundJobs.Quartz --version 1.0.0-alpha.16
                    
NuGet\Install-Package Muonroi.BackgroundJobs.Quartz -Version 1.0.0-alpha.16
                    
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="Muonroi.BackgroundJobs.Quartz" Version="1.0.0-alpha.16" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Muonroi.BackgroundJobs.Quartz" Version="1.0.0-alpha.16" />
                    
Directory.Packages.props
<PackageReference Include="Muonroi.BackgroundJobs.Quartz" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Muonroi.BackgroundJobs.Quartz --version 1.0.0-alpha.16
                    
#r "nuget: Muonroi.BackgroundJobs.Quartz, 1.0.0-alpha.16"
                    
#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.
#:package Muonroi.BackgroundJobs.Quartz@1.0.0-alpha.16
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Muonroi.BackgroundJobs.Quartz&version=1.0.0-alpha.16&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=Muonroi.BackgroundJobs.Quartz&version=1.0.0-alpha.16&prerelease
                    
Install as a Cake Tool

Muonroi.BackgroundJobs.Quartz

Quartz.NET provider for the Muonroi background-jobs abstraction — swap in Quartz with a single config change, no code rewrites.

NuGet License: Commercial

This package wires Quartz.NET into the IBackgroundJobScheduler abstraction defined by Muonroi.BackgroundJobs.Abstractions. It registers a Quartz hosted service, a global QuartzContextJobListener that restores Muonroi execution context (tenant ID, user, correlation ID, access token) before each job runs, and an IBackgroundJobScheduler scoped service. The assembly uses a [ModuleInitializer] to self-register the JobType.Quartz provider with BackgroundJobHandler at load time — no manual wiring beyond adding the package reference.

Note: Expression-based scheduling (Enqueue<T>, Schedule<T>, AddOrUpdateRecurring<T>) is not yet supported in this provider. Quartz jobs must be class-based (implement IJob). For expression-based scheduling use Muonroi.BackgroundJobs.Hangfire instead.

Installation

dotnet add package Muonroi.BackgroundJobs.Quartz --prerelease

Quick Start

Add the configuration section to appsettings.json:

{
  "BackgroundJobConfigs": {
    "JobType": "Quartz",
    "ConnectionString": null
  }
}

Register in Program.cs:

// Reference Muonroi.BackgroundJobs.Quartz — its [ModuleInitializer] registers
// the Quartz provider with BackgroundJobHandler automatically on assembly load.
using Muonroi.BackgroundJobs.Abstractions;

builder.Services.AddBackgroundJobs(builder.Configuration);

Define a class-based job (Quartz IJob):

using Quartz;

public sealed class DataCleanupJob : IJob
{
    public Task Execute(IJobExecutionContext context)
    {
        // Muonroi execution context (tenant, user, correlationId) is already
        // restored by QuartzContextJobListener before this method is called.
        return Task.CompletedTask;
    }
}

Schedule the job at startup using the native Quartz API (inject ISchedulerFactory):

IScheduler scheduler = await schedulerFactory.GetScheduler();
IJobDetail job = JobBuilder.Create<DataCleanupJob>()
    .WithIdentity("data-cleanup")
    .Build();
ITrigger trigger = TriggerBuilder.Create()
    .WithCronSchedule("0 2 * * ?")
    .Build();
await scheduler.ScheduleJob(job, trigger);

Features

  • Registers Quartz, Quartz.Extensions.DependencyInjection, and Quartz.Extensions.Hosting with a single AddBackgroundJobs call.
  • Validates that BackgroundJobConfigs:JobType is Quartz; throws MConfigurationException if misconfigured.
  • QuartzContextJobListener restores the full Muonroi SystemExecutionContext (tenant ID, user ID, username, correlation ID, access token, API key, permissions) for every job execution via IJobExecutionContext.MergedJobDataMap.
  • Quartz hosted service is configured with WaitForJobsToComplete = true for graceful shutdown.
  • AOT-safe: provider registration uses a compile-time delegate, no reflection.
  • Self-registering: merely adding the package reference causes [ModuleInitializer] to enroll the JobType.Quartz provider — no extra DI calls needed.

Configuration

BackgroundJobConfigs options

Property Type Default Description
JobType JobType Quartz Must be Quartz for this package.
ConnectionString string? null Optional; passed through for persistence store setup if needed.

BackgroundJobConfigs.SectionName is the constant "BackgroundJobConfigs".

API Reference

Type Purpose
BackgroundJobHandler (static) Extension class; exposes AddBackgroundJobs(IServiceCollection, IConfiguration)
BackgroundJobConfigs Options POCO bound from "BackgroundJobConfigs" config section
QuartzContextJobListener IJobListener that restores Muonroi SystemExecutionContext before each job
QuartzJobScheduler Scoped IBackgroundJobScheduler implementation (class-based jobs only)

Samples

  • Quickstart.BackgroundJobs — demonstrates provider selection (Hangfire vs Quartz via JobType config), class-based job definitions, and IBackgroundJobScheduler usage.

Compatibility

  • Target framework: net8.0
  • License: Commercial — requires activation

License

This package is distributed under a commercial license. A valid Muonroi license is required for production use. See LICENSE-COMMERCIAL for terms.

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  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.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on Muonroi.BackgroundJobs.Quartz:

Package Downloads
Muonroi.BuildingBlock.All

Metapackage for Muonroi Building Block - Includes all sub-packages for a complete infrastructure setup.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.0-alpha.16 52 6/22/2026
1.0.0-alpha.15 79 5/31/2026
1.0.0-alpha.14 75 5/15/2026
1.0.0-alpha.13 74 5/2/2026
1.0.0-alpha.12 78 4/2/2026
1.0.0-alpha.11 129 4/2/2026
1.0.0-alpha.8 158 3/28/2026
1.0.0-alpha.1 66 3/8/2026