Autofac.Extras.Quartz 11.1.0-alpha0002

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: dotnet add 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.

No packages depend on Autofac.Extras.Quartz.

https://github.com/alphacloud/Autofac.Extras.Quartz/milestone/32

.NET 8.0

.NET Standard 2.1

.NET Standard 2.0

.NET 10.0

.NET 9.0

Version Downloads Last updated
11.1.0-alpha0002 4 3/7/2026
11.0.0 3 3/5/2026
10.1.0-alpha0007 3 2/14/2026
10.0.0 4 6/12/2025
10.0.0-alpha0007 3 6/13/2025
10.0.0-alpha0006 5 6/14/2025
9.0.0 12 6/13/2025
8.2.0 10 6/14/2025
8.2.0-alpha0001 13 6/14/2025
8.1.0 12 6/13/2025
8.1.0-alpha0003 10 6/13/2025
8.1.0-alpha0002 11 6/14/2025
8.0.0 12 6/14/2025
7.4.0-alpha0007 12 6/14/2025
7.4.0-alpha0005 11 6/13/2025
7.4.0-alpha0002 12 6/14/2025
7.3.0 18 6/13/2025
7.3.0-alpha0009 10 6/13/2025
7.2.0 13 6/14/2025
7.2.0-alpha0006 12 6/14/2025
7.1.0 12 6/13/2025
7.1.0-alpha0011 14 6/13/2025
7.1.0-alpha0010 11 6/13/2025
7.1.0-alpha0009 10 6/13/2025
7.1.0-alpha0008 10 6/14/2025
7.1.0-alpha0006 10 6/14/2025
7.1.0-alpha0004 11 6/13/2025
7.1.0-alpha0003 9 6/14/2025
7.1.0-alpha0002 12 6/14/2025
7.1.0-alpha0001 13 6/14/2025
7.0.0 11 6/13/2025
7.0.0-beta0001 11 6/14/2025
7.0.0-alpha0024 10 6/13/2025
7.0.0-alpha0023 12 6/14/2025
6.3.0-alpha0001 12 6/14/2025
6.2.0 12 6/14/2025
6.2.0-beta0001 11 6/13/2025
6.2.0-alpha0008 12 6/13/2025
6.2.0-alpha0001 13 6/14/2025
6.1.0 13 6/13/2025
6.1.0-beta0001 13 6/14/2025
6.0.1 12 6/14/2025
6.0.1-beta0001 9 6/14/2025
6.0.0 11 6/13/2025
6.0.0-beta0001 12 6/14/2025
6.0.0-alpha0041 12 6/14/2025
6.0.0-alpha0039 12 6/13/2025
5.4.0 11 6/13/2025
5.4.0-beta0001 11 6/14/2025
5.4.0-alpha0007 12 6/13/2025
5.4.0-alpha0001 18 6/14/2025
5.3.0 11 6/14/2025
5.3.0-beta0001 14 6/13/2025
5.3.0-alpha0009 12 6/14/2025
5.3.0-alpha0008 13 6/13/2025
5.3.0-alpha0007 10 6/13/2025
5.3.0-alpha0001 11 6/14/2025
5.2.0 11 6/13/2025
5.2.0-beta0001 11 6/14/2025
5.2.0-alpha0023 11 6/14/2025
5.2.0-alpha0021 12 6/14/2025
5.1.0 11 6/14/2025
5.1.0-alpha0015 13 6/14/2025
5.1.0-alpha0014 11 6/14/2025
5.1.0-alpha0005 11 6/13/2025
5.0.0 11 6/14/2025
5.0.0-beta0001 11 6/13/2025
5.0.0-alpha0064 11 6/13/2025
4.7.0-alpha0013 11 6/14/2025
4.7.0-alpha0009 11 6/14/2025
4.7.0-alpha0007 12 6/13/2025
4.7.0-alpha0006 13 6/13/2025
4.7.0-alpha0005 11 6/13/2025
4.7.0-alpha0004 11 6/13/2025
4.6.0 12 6/14/2025
4.6.0-beta0001 12 6/13/2025
4.6.0-alpha0036 24 6/14/2025
4.6.0-alpha0034 13 6/14/2025
4.6.0-alpha0033 13 6/14/2025
4.6.0-alpha0028 13 6/13/2025
4.6.0-alpha0026 12 6/13/2025
4.6.0-alpha0024 11 6/14/2025
4.6.0-alpha0022 12 6/14/2025
4.6.0-alpha0018 12 6/17/2025
4.6.0-alpha0008 12 6/14/2025
4.6.0-alpha0005 11 6/14/2025
4.6.0-alpha0003 13 6/14/2025
4.6.0-alpha0001 11 6/11/2025
4.5.1 11 6/13/2025
4.5.1-beta0001 12 6/14/2025
4.5.0 12 6/14/2025
4.5.0-beta0001 10 6/14/2025
4.5.0-alpha0008 13 6/14/2025
4.5.0-alpha0007 11 6/13/2025
4.5.0-alpha0005 11 6/14/2025
4.5.0-alpha0003 13 6/14/2025
4.5.0-alpha0002 11 6/13/2025
4.5.0-alpha0001 11 6/13/2025
4.4.0 13 6/13/2025
4.4.0-beta0001 11 6/14/2025
4.4.0-alpha0014 11 6/13/2025
4.4.0-alpha0013 10 6/13/2025
4.4.0-alpha0012 10 6/14/2025
4.4.0-alpha0002 13 6/13/2025
4.4.0-alpha0001 12 6/13/2025
4.3.0 11 6/14/2025
4.3.0-beta0001 12 6/13/2025
4.3.0-alpha0008 12 6/14/2025
4.3.0-alpha0007 11 6/13/2025
4.3.0-alpha0006 11 6/14/2025
4.3.0-alpha0005 11 6/13/2025
4.2.0 11 6/13/2025
4.2.0-beta0001 12 6/13/2025
4.2.0-alpha0004 13 6/13/2025
4.2.0-alpha0003 14 6/14/2025
4.2.0-alpha0002 11 6/13/2025
4.2.0-alpha0001 11 6/14/2025
4.1.2 13 6/13/2025
4.1.1 12 6/14/2025
4.1.0-beta0004 11 6/13/2025
4.1.0-beta0001 13 6/13/2025
4.1.0-alpha0016 11 6/13/2025
4.0.0 15 6/14/2025
4.0.0-beta0007 11 6/14/2025
4.0.0-beta0006 12 6/14/2025
4.0.0-beta0001 12 6/14/2025
3.5.0 12 6/14/2025
3.5.0-unstable0012 11 6/14/2025
3.5.0-unstable0010 12 6/14/2025
3.5.0-unstable0004 12 6/13/2025
3.5.0-unstable0003 11 6/14/2025
3.5.0-unstable0002 9 6/14/2025
3.5.0-unstable0001 12 6/14/2025
3.5.0-beta0001 13 6/13/2025
3.4.0 11 6/13/2025
3.4.0-unstable0009 10 6/14/2025
3.4.0-unstable0008 9 6/14/2025
3.4.0-unstable0007 10 6/13/2025
3.4.0-unstable0006 12 6/13/2025
3.4.0-unstable0004 11 6/14/2025
3.4.0-unstable0001 12 6/14/2025
3.4.0-ci0000 12 6/14/2025
3.3.0 11 6/14/2025
3.3.0-unstable0001 10 6/16/2025
3.3.0-unstable0000 11 6/13/2025
3.2.0 12 6/14/2025
3.2.0-beta0001 11 6/13/2025
3.1.0 11 6/14/2025
3.1.0-unstable0022 11 6/14/2025
3.1.0-unstable0021 9 6/14/2025
3.0.0-unstable0020 10 6/14/2025
3.0.0-unstable0017 10 6/14/2025
3.0.0-unstable0013 13 6/14/2025
3.0.0-unstable0012 10 6/13/2025
3.0.0-unstable0011 12 6/14/2025
3.0.0-beta-1 11 6/13/2025
3.0.0-alpha0014 41 6/13/2025
2.2.0-unstable0012 29 6/14/2025
2.1.1 11 6/14/2025
2.1.0 16 6/14/2025
2.0.0.1 11 6/14/2025
1.7.0 13 6/13/2025
1.6.0 11 6/14/2025
1.5.1 10 6/14/2025
1.5.0 12 6/8/2025
1.4.0 12 6/14/2025
1.3.0 11 6/14/2025
1.2.0 12 6/13/2025
1.1.1 12 6/13/2025
1.1.0 11 6/14/2025
1.0.0 11 6/13/2025
0.11.0 11 6/13/2025
0.10.0 11 6/13/2025
0.9.0 11 6/14/2025