Autofac.Extras.Quartz 10.0.0

dotnet add package Autofac.Extras.Quartz --version 10.0.0
NuGet\Install-Package Autofac.Extras.Quartz -Version 10.0.0
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="Autofac.Extras.Quartz" Version="10.0.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Autofac.Extras.Quartz --version 10.0.0
#r "nuget: Autofac.Extras.Quartz, 10.0.0"
#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 Autofac.Extras.Quartz as a Cake Addin
#addin nuget:?package=Autofac.Extras.Quartz&version=10.0.0

// Install Autofac.Extras.Quartz as a Cake Tool
#tool nuget:?package=Autofac.Extras.Quartz&version=10.0.0

Autofac.Extras.Quartz

Autofac integration package for Quartz.Net.

Autofac.Extras.Quartz creates nested litefime scope for each Quartz Job. Nested scope is disposed after job execution has been completed.

This allows to have single instance per job execution as well as deterministic disposal of resources.

Install package via Nuget: install-package Autofac.Extras.Quartz

Build status

Stable Pre-release
Build Master branch Development branch
NuGet NuGet NuGet
CodeCov codecov codecov

Usage example

Autofac configuration for Quartz includes two steps:

  1. Scheduler registration
  2. Job registration

Scheduler registration

QuartzAutofacFactoryModule registers custom ISchedulerFactory and default instance of IScheduler in Autofac container. Both factory and schedulere are registered as singletones. Note: Is is important to resolve IScheduler from container, rather than using default one to get jobs resolved by Autofac.

Optionally custom Quartz configuration can be passed using ConfigurationProvider property. Provider is callback which returns settings using NameValueCollection.

Job scope configuration

Starting with version 7 QuartzAutofacFactoryModule provides a way to customize lifetime scope configuration for job. This can be done via JobScopeConfigurator parameter.

cb.Register(_ => new ScopedDependency("global"))
    .AsImplementedInterfaces()
    .SingleInstance();

cb.RegisterModule(new QuartzAutofacFactoryModule {
    JobScopeConfigurator = (builder, jobScopeTag) => {
        // override dependency for job scope
        builder.Register(_ => new ScopedDependency("job-local "+ DateTime.UtcNow.ToLongTimeString()))
            .AsImplementedInterfaces()
            .InstancePerMatchingLifetimeScope(jobScopeTag);

    }
});

See src/Samples/Shared/Bootstrap.cs for details.

Job registration

QuartzAutofacJobsModule scans given assemblies and registers all non-abstract implementors of IJob interface as transient instances.

internal static ContainerBuilder ConfigureContainer(ContainerBuilder cb)
{
	// 1) Register IScheduler
	cb.RegisterModule(new QuartzAutofacFactoryModule()); 
	// 2) Register jobs
	cb.RegisterModule(new QuartzAutofacJobsModule(typeof (CleanupExpiredAnnouncemetsJob).Assembly));
}

Starting Quartz

Make sure to start the scheduler after it was resolved from Autofac. E.g.

var scheduler = _container.Resolve<IScheduler>();
scheduler.Start();

Sample projects

TopShelf-based sample was removed since Topshelf.Quartz is not compatible with Quartz 3 as af now.

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  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 is compatible.  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 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. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 is compatible. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (14)

Showing the top 5 NuGet packages that depend on Autofac.Extras.Quartz:

Package Downloads
Lauener.Core.Triggers

A easy to use Quartz implementation

TripleSix.Core

Package Description

HwApp.Quartz

HwApp Quartz & Quartzmin

SyWaterStandardLibrary

舜禹框架Core 3.0

Inaction.Web

.net core Web快速开发框架

GitHub repositories (1)

Showing the top 1 popular GitHub repositories that depend on Autofac.Extras.Quartz:

Repository Stars
PlexRipper/PlexRipper
The best cross-platform Plex media downloader there is! In active development and feedback is very welcome!
Version Downloads Last updated
10.0.0 2,694 3/7/2024
10.0.0-alpha0007 77 3/5/2024
10.0.0-alpha0006 95 3/4/2024
9.0.0 110,234 3/27/2023
8.2.0 48,226 1/30/2023
8.2.0-alpha0001 162 1/30/2023
8.1.0 2,302 1/24/2023
8.1.0-alpha0003 183 12/22/2022
8.1.0-alpha0002 163 12/22/2022
8.0.0 122,870 6/3/2022
7.4.0-alpha0007 221 6/2/2022
7.4.0-alpha0005 6,302 5/17/2022
7.4.0-alpha0002 164 5/8/2022
7.3.0 168,937 10/28/2021
7.3.0-alpha0009 257 10/28/2021
7.2.0 45,895 8/2/2021
7.2.0-alpha0006 269 8/1/2021
7.1.0 61,579 4/25/2021
7.1.0-alpha0011 277 8/1/2021
7.1.0-alpha0010 312 8/1/2021
7.1.0-alpha0009 331 8/1/2021
7.1.0-alpha0008 276 6/20/2021
7.1.0-alpha0006 269 4/30/2021
7.1.0-alpha0004 271 4/24/2021
7.1.0-alpha0003 284 4/24/2021
7.1.0-alpha0002 263 4/19/2021
7.1.0-alpha0001 256 4/19/2021
7.0.0 147,713 2/16/2021
7.0.0-beta0001 270 2/14/2021
7.0.0-alpha0024 288 2/14/2021
7.0.0-alpha0023 286 2/9/2021
6.3.0-alpha0001 281 2/9/2021
6.2.0 12,717 1/29/2021
6.2.0-beta0001 275 1/29/2021
6.2.0-alpha0008 289 1/28/2021
6.2.0-alpha0001 408 1/10/2021
6.1.0 17,126 1/10/2021
6.1.0-beta0001 318 1/4/2021
6.0.1 41,351 10/21/2020
6.0.1-beta0001 425 10/21/2020
6.0.0 51,337 10/9/2020
6.0.0-beta0001 390 10/9/2020
6.0.0-alpha0041 399 10/7/2020
6.0.0-alpha0039 427 10/7/2020
5.4.0 31,893 10/7/2020
5.4.0-beta0001 393 10/4/2020
5.4.0-alpha0007 389 10/4/2020
5.4.0-alpha0001 607 8/6/2020
5.3.0 35,030 8/6/2020
5.3.0-beta0001 413 8/6/2020
5.3.0-alpha0009 423 8/6/2020
5.3.0-alpha0008 477 7/27/2020
5.3.0-alpha0007 490 7/8/2020
5.3.0-alpha0001 1,020 5/19/2020
5.2.0 97,054 5/19/2020
5.2.0-beta0001 450 5/19/2020
5.2.0-alpha0023 446 5/19/2020
5.2.0-alpha0021 727 2/17/2020
5.1.0 145,477 2/17/2020
5.1.0-alpha0015 445 2/17/2020
5.1.0-alpha0014 521 2/8/2020
5.1.0-alpha0005 526 1/30/2020
5.0.0 23,316 1/30/2020
5.0.0-beta0001 534 1/30/2020
5.0.0-alpha0064 458 1/30/2020
4.7.0-alpha0013 1,541 1/29/2020
4.7.0-alpha0009 481 1/27/2020
4.7.0-alpha0007 1,620 11/18/2019
4.7.0-alpha0006 474 11/17/2019
4.7.0-alpha0005 510 11/8/2019
4.7.0-alpha0004 1,129 9/2/2019
4.6.0 187,662 9/2/2019
4.6.0-beta0001 531 9/1/2019
4.6.0-alpha0036 516 9/1/2019
4.6.0-alpha0034 504 9/1/2019
4.6.0-alpha0033 501 9/1/2019
4.6.0-alpha0028 589 7/13/2019
4.6.0-alpha0026 535 7/13/2019
4.6.0-alpha0024 514 7/6/2019
4.6.0-alpha0022 512 7/6/2019
4.6.0-alpha0018 514 7/6/2019
4.6.0-alpha0008 669 5/8/2019
4.6.0-alpha0005 535 5/8/2019
4.6.0-alpha0003 564 5/8/2019
4.6.0-alpha0001 694 3/10/2019
4.5.1 166,279 5/8/2019
4.5.1-beta0001 562 5/8/2019
4.5.0 109,025 3/9/2019
4.5.0-beta0001 567 3/9/2019
4.5.0-alpha0008 539 3/9/2019
4.5.0-alpha0007 560 3/8/2019
4.5.0-alpha0005 579 2/25/2019
4.5.0-alpha0003 814 2/11/2019
4.5.0-alpha0002 634 1/28/2019
4.5.0-alpha0001 649 1/27/2019
4.4.0 96,274 1/27/2019
4.4.0-beta0001 680 1/27/2019
4.4.0-alpha0014 1,015 9/29/2018
4.4.0-alpha0013 728 9/29/2018
4.4.0-alpha0012 718 9/29/2018
4.4.0-alpha0002 780 9/23/2018
4.4.0-alpha0001 739 9/19/2018
4.3.0 148,867 9/29/2018
4.3.0-beta0001 745 9/26/2018
4.3.0-alpha0008 1,363 7/11/2018
4.3.0-alpha0007 927 7/7/2018
4.3.0-alpha0006 920 7/7/2018
4.3.0-alpha0005 929 7/1/2018
4.2.0 39,131 7/1/2018
4.2.0-beta0001 904 6/30/2018
4.2.0-alpha0004 895 7/1/2018
4.2.0-alpha0003 1,325 5/13/2018
4.2.0-alpha0002 952 5/13/2018
4.2.0-alpha0001 958 5/13/2018
4.1.2 1,190 6/30/2018
4.1.1 57,332 5/13/2018
4.1.0-beta0004 959 5/13/2018
4.1.0-beta0001 972 5/13/2018
4.1.0-alpha0016 1,278 4/14/2018
4.0.0 61,772 1/14/2018
4.0.0-beta0007 1,070 1/14/2018
4.0.0-beta0006 970 1/13/2018
4.0.0-beta0001 933 1/13/2018
3.5.0 87,062 4/14/2018
3.5.0-unstable0012 1,079 1/5/2018
3.5.0-unstable0010 1,369 8/15/2017
3.5.0-unstable0004 916 8/1/2017
3.5.0-unstable0003 926 7/25/2017
3.5.0-unstable0002 959 6/21/2017
3.5.0-unstable0001 1,002 6/15/2017
3.5.0-beta0001 1,135 4/14/2018
3.4.0 109,691 5/5/2017
3.4.0-unstable0009 940 4/5/2017
3.4.0-unstable0008 935 4/5/2017
3.4.0-unstable0007 963 4/5/2017
3.4.0-unstable0006 925 4/5/2017
3.4.0-unstable0004 1,036 2/15/2017
3.4.0-unstable0001 1,030 12/4/2016
3.4.0-ci0000 916 4/5/2017
3.3.0 68,937 11/1/2016
3.3.0-unstable0001 1,038 11/1/2016
3.3.0-unstable0000 934 10/10/2016
3.2.0 7,624 10/10/2016
3.2.0-beta0001 941 10/10/2016
3.1.0 53,929 8/25/2016
3.1.0-unstable0022 921 10/9/2016
3.1.0-unstable0021 942 10/9/2016
3.0.0-unstable0020 1,046 7/17/2016
3.0.0-unstable0017 1,013 8/24/2016
3.0.0-unstable0013 974 7/17/2016
3.0.0-unstable0012 984 7/17/2016
3.0.0-unstable0011 976 7/17/2016
3.0.0-beta-1 1,055 7/4/2016
3.0.0-alpha0014 933 7/20/2016
2.2.0-unstable0012 1,022 7/19/2016
2.1.1 17,580 7/16/2016
2.1.0 36,870 4/8/2016
2.0.0.1 1,589 4/6/2016
1.7.0 37,130 10/29/2015
1.6.0 3,082 10/25/2015
1.5.1 17,690 7/14/2015
1.5.0 1,311 7/14/2015
1.4.0 4,874 6/12/2015
1.3.0 16,360 2/1/2015
1.2.0 2,833 1/26/2015
1.1.1 5,791 11/15/2014
1.1.0 9,951 7/13/2014
1.0.0 2,564 7/2/2014
0.11.0 1,857 5/18/2014
0.10.0 1,744 4/9/2014
0.9.0 5,271 4/7/2014