This is a sixth part of a series:
- part 1 - Why schedule and procrastinate jobs?
- part 2 - Overview of Hangfie
- part 3 - Scheduling and Queuing jobs in Hangfire
- part 4 - Dashboard, retries and job cancellation
- part 5 - Job continuation with ContinueWith
- part 6 - Recurring jobs and cron expressions
Parts 3, 4, and 5 covered the
BackgroundJob class responsible for enqueuing single jobs (fire and forget). This post will cover
RecurringJob class exposing API for recurring jobs (as the name suggests).
Before we go into the API, let’s take a look what is a recurring job in Hangfire. Recurring job is a timer that enqueues a job at specific time intervals defined with a cron expression. What is important is, that it does not execute the job. Only enqueues an ordinary Hangfire job. This implementation is very elegant, but it also means that if the queue is full the job will have to wait for its turn. So there is no guarantee about the time it will actually execute.Continue reading...