Skip to content

A simple example to run background jobs with asp.net core applicaiton.

Notifications You must be signed in to change notification settings

mail4hafij/quartz_job_asp_dotnet_core

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Quartz job example

A simple example to run background jobs with asp.net core applicaiton.

// Quartz hosted service START
builder.Services.AddQuartz(q =>
{
    var notificationJobKey = new JobKey(nameof(NotificationJob));
    // job
    q.AddJob<NotificationJob>(notificationJobKey);
    // trigger - every 30 seconds!
    q.AddTrigger(trigger => trigger
        .ForJob(notificationJobKey)
        .WithSimpleSchedule(sch =>
            sch.WithIntervalInSeconds(30).RepeatForever()));

});
builder.Services.AddQuartzHostedService(q => q.WaitForJobsToComplete = true);
// Quartz END

The project has an empty job called NotificaitonJob. Put a breakpoint and check if it is called every 30 seconds!

Enjoy!

About

A simple example to run background jobs with asp.net core applicaiton.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages