Quartz Background Job Manager

    It is suggested to use the ABP CLI to install this package.

    Open a command line window in the folder of the project (.csproj file) and type the following command:

    1. Add the NuGet package to your project:

    2. Add the AbpBackgroundJobsQuartzModule to the dependency list of your module:

    Quartz is a very configurable library,and the ABP framework provides AbpQuartzOptions for this. You can use the PreConfigure method in your module class to pre-configure this option. ABP will use it when initializing the Quartz module. For example:

    1. [DependsOn(
    2. //...other dependencies
    3. typeof(AbpBackgroundJobsQuartzModule) //Add the new module dependency
    4. )]
    5. public class YourModule : AbpModule
    6. {
    7. {
    8. var configuration = context.Services.GetConfiguration();
    9. PreConfigure<AbpQuartzOptions>(options =>
    10. {
    11. {
    12. ["quartz.jobStore.dataSource"] = "BackgroundJobsDemoApp",
    13. ["quartz.jobStore.type"] = "Quartz.Impl.AdoJobStore.JobStoreTX, Quartz",
    14. ["quartz.jobStore.tablePrefix"] = "QRTZ_",
    15. ["quartz.serializer.type"] = "json",
    16. ["quartz.dataSource.BackgroundJobsDemoApp.connectionString"] = configuration.GetConnectionString("Quartz"),
    17. ["quartz.dataSource.BackgroundJobsDemoApp.provider"] = "SqlServer",
    18. ["quartz.jobStore.driverDelegateType"] = "Quartz.Impl.AdoJobStore.SqlServerDelegate, Quartz",
    19. };
    20. });
    21. }

    You can choose the way you favorite to configure Quaratz.

    Quartz stores job and scheduling information in memory by default. In the example, we use the pre-configuration of options pattern to change it to the database. For more configuration of Quartz, please refer to the Quartz’s .

    When an exception occurs in the background job,ABP provide the default handling strategy retrying once every 3 seconds, up to 3 times. You can change the retry count and retry interval via AbpBackgroundJobQuartzOptions options:

    1. //...other dependencies
    2. typeof(AbpBackgroundJobsQuartzModule) //Add the new module dependency
    3. )]
    4. public class YourModule : AbpModule
    5. {
    6. public override void ConfigureServices(ServiceConfigurationContext context)
    7. {
    8. Configure<AbpBackgroundJobQuartzOptions>(options =>
    9. {
    10. options.RetryCount = 1;
    11. options.RetryIntervalMillisecond = 1000;
    12. });
    13. }
    14. }