Starts in:
0 DAY
21 HRS
24 MIN
55 SEC
Starts in:
0 D
21 H
24 M
55 S

Quartz Background Worker Manager

Quartz is an advanced background worker manager. You can integrate Quartz with the ABP Framework to use it instead of the default background worker manager. ABP simply integrates quartz.

Installation

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

Using the ABP CLI

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

abp add-package Volo.Abp.BackgroundWorkers.Quartz

Manual Installation

If you want to manually install;

  1. Add the Volo.Abp.BackgroundWorkers.Quartz NuGet package to your project:

    Install-Package Volo.Abp.BackgroundWorkers.Quartz
    
  2. Add the AbpBackgroundWorkersQuartzModule to the dependency list of your module:

[DependsOn(
    //...other dependencies
    typeof(AbpBackgroundWorkersQuartzModule) //Add the new module dependency
    )]
public class YourModule : AbpModule
{
}

Configuration

See Configuration.

Create a Background Worker

A background work is a class that derives from the QuartzBackgroundWorkerBase base class. for example. A simple worker class is shown below:

public class MyLogWorker : QuartzBackgroundWorkerBase
{
    public MyLogWorker()
    {
        JobDetail = JobBuilder.Create<MyLogWorker>().Build();
        Trigger = TriggerBuilder.Create().StartNow().Build();
    }

    public override Task Execute(IJobExecutionContext context)
    {
        Logger.LogInformation("Executed MyLogWorker..!");
        return Task.CompletedTask;
    }
}

We simply implemented the Execute method to write a log. The background worker is a singleton by default. If you want, you can also implement a dependency interface to register it as another life cycle.

More

Please see Quartz's documentation for more information.

Contributors


Last updated: March 09, 2020 Edit this page on GitHub

Was this page helpful?

Please make a selection.

To help us improve, please share your reason for the negative feedback in the field below.

Please enter a note.

Thank you for your valuable feedback!

Please note that although we cannot respond to feedback, our team will use your comments to improve the experience.

In this document
Community Talks

What’s New with .NET 9 & ABP 9?

21 Nov, 17:00
Online
Watch the Event
Mastering ABP Framework Book
Mastering ABP Framework

This book will help you gain a complete understanding of the framework and modern web application development techniques.

Learn More