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:
Add the NuGet package to your project:
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:
[DependsOn(
//...other dependencies
typeof(AbpBackgroundJobsQuartzModule) //Add the new module dependency
)]
public class YourModule : AbpModule
{
{
var configuration = context.Services.GetConfiguration();
PreConfigure<AbpQuartzOptions>(options =>
{
{
["quartz.jobStore.dataSource"] = "BackgroundJobsDemoApp",
["quartz.jobStore.type"] = "Quartz.Impl.AdoJobStore.JobStoreTX, Quartz",
["quartz.jobStore.tablePrefix"] = "QRTZ_",
["quartz.serializer.type"] = "json",
["quartz.dataSource.BackgroundJobsDemoApp.connectionString"] = configuration.GetConnectionString("Quartz"),
["quartz.dataSource.BackgroundJobsDemoApp.provider"] = "SqlServer",
["quartz.jobStore.driverDelegateType"] = "Quartz.Impl.AdoJobStore.SqlServerDelegate, Quartz",
};
});
}
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:
//...other dependencies
typeof(AbpBackgroundJobsQuartzModule) //Add the new module dependency
)]
public class YourModule : AbpModule
{
public override void ConfigureServices(ServiceConfigurationContext context)
{
Configure<AbpBackgroundJobQuartzOptions>(options =>
{
options.RetryCount = 1;
options.RetryIntervalMillisecond = 1000;
});
}
}