Autofac.Extras.Quartz 10.0.0-alpha0007

This is a prerelease version of Autofac.Extras.Quartz.
There is a newer version of this package available.
See the version list below for details.
dotnet add package Autofac.Extras.Quartz --version 10.0.0-alpha0007
                    
NuGet\Install-Package Autofac.Extras.Quartz -Version 10.0.0-alpha0007
                    
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-alpha0007" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Autofac.Extras.Quartz" Version="10.0.0-alpha0007" />
                    
Directory.Packages.props
<PackageReference Include="Autofac.Extras.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 Autofac.Extras.Quartz --version 10.0.0-alpha0007
                    
#r "nuget: Autofac.Extras.Quartz, 10.0.0-alpha0007"
                    
#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 Autofac.Extras.Quartz@10.0.0-alpha0007
                    
#: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=Autofac.Extras.Quartz&version=10.0.0-alpha0007&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=Autofac.Extras.Quartz&version=10.0.0-alpha0007&prerelease
                    
Install as a Cake Tool

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.  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. 
.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 (13)

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

Package Downloads
Lauener.Core.Triggers

A easy to use Quartz implementation

HwApp.Quartz

HwApp Quartz & Quartzmin

SyWaterStandardLibrary

舜禹框架Core 3.0

Cogito.Quartz.Autofac

Provides utilites and extensions for Quartz and Autofac.

Inaction.Web

.net core Web快速开发框架

GitHub repositories (1)

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

Repository Stars
Reaparr/Reaparr
Plex downloader that brings content from any server to yours!
Version Downloads Last Updated
10.0.0 382,025 3/7/2024
10.0.0-alpha0007 194 3/5/2024
10.0.0-alpha0006 209 3/4/2024
9.0.0 238,114 3/27/2023
8.2.0 74,585 1/30/2023
8.2.0-alpha0001 303 1/30/2023
8.1.0 2,718 1/24/2023
8.1.0-alpha0003 317 12/22/2022
8.1.0-alpha0002 299 12/22/2022
8.0.0 154,743 6/3/2022
7.4.0-alpha0007 382 6/2/2022
7.4.0-alpha0005 11,111 5/17/2022
7.4.0-alpha0002 336 5/8/2022
7.3.0 198,088 10/28/2021
7.3.0-alpha0009 422 10/28/2021
7.2.0 51,792 8/2/2021
7.2.0-alpha0006 435 8/1/2021
7.1.0 69,735 4/25/2021
7.1.0-alpha0011 439 8/1/2021
7.1.0-alpha0010 463 8/1/2021
7.1.0-alpha0009 490 8/1/2021
7.1.0-alpha0008 447 6/20/2021
7.1.0-alpha0006 429 4/30/2021
7.1.0-alpha0004 427 4/24/2021
7.1.0-alpha0003 472 4/24/2021
7.1.0-alpha0002 427 4/19/2021
7.1.0-alpha0001 393 4/19/2021
7.0.0 228,162 2/16/2021
7.0.0-beta0001 451 2/14/2021
7.0.0-alpha0024 463 2/14/2021
7.0.0-alpha0023 463 2/9/2021
6.3.0-alpha0001 443 2/9/2021
6.2.0 15,847 1/29/2021
6.2.0-beta0001 446 1/29/2021
6.2.0-alpha0008 470 1/28/2021
6.2.0-alpha0001 577 1/10/2021
6.1.0 18,202 1/10/2021
6.1.0-beta0001 501 1/4/2021
6.0.1 48,872 10/21/2020
6.0.1-beta0001 606 10/21/2020
6.0.0 77,328 10/9/2020
6.0.0-beta0001 566 10/9/2020
6.0.0-alpha0041 583 10/7/2020
6.0.0-alpha0039 612 10/7/2020
5.4.0 46,496 10/7/2020
5.4.0-beta0001 560 10/4/2020
5.4.0-alpha0007 568 10/4/2020
5.4.0-alpha0001 781 8/6/2020
5.3.0 43,044 8/6/2020
5.3.0-beta0001 599 8/6/2020
5.3.0-alpha0009 610 8/6/2020
5.3.0-alpha0008 658 7/27/2020
5.3.0-alpha0007 649 7/8/2020
5.3.0-alpha0001 1,222 5/19/2020
5.2.0 117,569 5/19/2020
5.2.0-beta0001 641 5/19/2020
5.2.0-alpha0023 638 5/19/2020
5.2.0-alpha0021 905 2/17/2020
5.1.0 169,829 2/17/2020
5.1.0-alpha0015 638 2/17/2020
5.1.0-alpha0014 671 2/8/2020
5.1.0-alpha0005 709 1/30/2020
5.0.0 29,304 1/30/2020
5.0.0-beta0001 721 1/30/2020
5.0.0-alpha0064 629 1/30/2020
4.7.0-alpha0013 3,385 1/29/2020
4.7.0-alpha0009 681 1/27/2020
4.7.0-alpha0007 2,246 11/18/2019
4.7.0-alpha0006 670 11/17/2019
4.7.0-alpha0005 705 11/8/2019
4.7.0-alpha0004 1,327 9/2/2019
4.6.0 245,210 9/2/2019
4.6.0-beta0001 721 9/1/2019
4.6.0-alpha0036 704 9/1/2019
4.6.0-alpha0034 700 9/1/2019
4.6.0-alpha0033 676 9/1/2019
4.6.0-alpha0028 750 7/13/2019
4.6.0-alpha0026 725 7/13/2019
4.6.0-alpha0024 694 7/6/2019
4.6.0-alpha0022 688 7/6/2019
4.6.0-alpha0018 702 7/6/2019
4.6.0-alpha0008 864 5/8/2019
4.6.0-alpha0005 722 5/8/2019
4.6.0-alpha0003 755 5/8/2019
4.6.0-alpha0001 878 3/10/2019
4.5.1 180,308 5/8/2019
4.5.1-beta0001 749 5/8/2019
4.5.0 110,666 3/9/2019
4.5.0-beta0001 753 3/9/2019
4.5.0-alpha0008 729 3/9/2019
4.5.0-alpha0007 758 3/8/2019
4.5.0-alpha0005 769 2/25/2019
4.5.0-alpha0003 1,010 2/11/2019
4.5.0-alpha0002 818 1/28/2019
4.5.0-alpha0001 854 1/27/2019
4.4.0 113,687 1/27/2019
4.4.0-beta0001 867 1/27/2019
4.4.0-alpha0014 1,249 9/29/2018
4.4.0-alpha0013 956 9/29/2018
4.4.0-alpha0012 929 9/29/2018
4.4.0-alpha0002 1,020 9/23/2018
4.4.0-alpha0001 941 9/19/2018
4.3.0 160,476 9/29/2018
4.3.0-beta0001 989 9/26/2018
4.3.0-alpha0008 1,825 7/11/2018
4.3.0-alpha0007 1,378 7/7/2018
4.3.0-alpha0006 1,382 7/7/2018
4.3.0-alpha0005 1,399 7/1/2018
4.2.0 45,398 7/1/2018
4.2.0-beta0001 1,348 6/30/2018
4.2.0-alpha0004 1,366 7/1/2018
4.2.0-alpha0003 1,797 5/13/2018
4.2.0-alpha0002 1,429 5/13/2018
4.2.0-alpha0001 1,434 5/13/2018
4.1.2 1,779 6/30/2018
4.1.1 63,877 5/13/2018
4.1.0-beta0004 1,423 5/13/2018
4.1.0-beta0001 1,433 5/13/2018
4.1.0-alpha0016 1,744 4/14/2018
4.0.0 71,582 1/14/2018
4.0.0-beta0007 1,535 1/14/2018
4.0.0-beta0006 1,456 1/13/2018
4.0.0-beta0001 1,414 1/13/2018
3.5.0 118,387 4/14/2018
3.5.0-unstable0012 1,535 1/5/2018
3.5.0-unstable0010 1,686 8/15/2017
3.5.0-unstable0004 1,251 8/1/2017
3.5.0-unstable0003 1,283 7/25/2017
3.5.0-unstable0002 1,313 6/21/2017
3.5.0-unstable0001 1,355 6/15/2017
3.5.0-beta0001 1,582 4/14/2018
3.4.0 131,552 5/5/2017
3.4.0-unstable0009 1,324 4/5/2017
3.4.0-unstable0008 1,300 4/5/2017
3.4.0-unstable0007 1,315 4/5/2017
3.4.0-unstable0006 1,263 4/5/2017
3.4.0-unstable0004 1,385 2/15/2017
3.4.0-unstable0001 1,382 12/4/2016
3.4.0-ci0000 1,268 4/5/2017
3.3.0 76,850 11/1/2016
3.3.0-unstable0001 1,392 11/1/2016
3.3.0-unstable0000 1,274 10/10/2016
3.2.0 8,848 10/10/2016
3.2.0-beta0001 1,289 10/10/2016
3.1.0 57,941 8/25/2016
3.1.0-unstable0022 1,278 10/9/2016
3.1.0-unstable0021 1,322 10/9/2016
3.0.0-unstable0020 1,400 7/17/2016
3.0.0-unstable0017 1,350 8/24/2016
3.0.0-unstable0013 1,332 7/17/2016
3.0.0-unstable0012 1,340 7/17/2016
3.0.0-unstable0011 1,322 7/17/2016
3.0.0-beta-1 1,399 7/4/2016
3.0.0-alpha0014 1,258 7/20/2016
2.2.0-unstable0012 1,375 7/19/2016
2.1.1 19,708 7/16/2016
2.1.0 39,352 4/8/2016
2.0.0.1 2,023 4/6/2016
1.7.0 45,246 10/29/2015
1.6.0 3,672 10/25/2015
1.5.1 21,316 7/14/2015
1.5.0 1,708 7/14/2015
1.4.0 5,300 6/12/2015
1.3.0 17,531 2/1/2015
1.2.0 4,188 1/26/2015
1.1.1 6,789 11/15/2014
1.1.0 10,853 7/13/2014
1.0.0 3,129 7/2/2014
0.11.0 2,286 5/18/2014
0.10.0 2,181 4/9/2014
0.9.0 6,435 4/7/2014