Difference between Hangfire background work and repetitive work?

In Hangfire, what is the difference between a background job and repetitive work? Since cron support is only provided in repetitive work, not in a background job?

+4
source share
1 answer

The recurring task is designed to run at specific intervals, that is, hourly, daily, so you provide a cron expression.

RecurringJob.AddOrUpdate(
    () => YourRegularJob(), 
    Cron.Daily);

The background task is intended to be performed once , either by placing it in the queue, or by performing it immediately, or by delaying the task, which must be completed at a certain time.

BackgroundJob.Enqueue(
    () => YourImmediateJob());

BackgroundJob.Schedule(
    () => YourDelayedJob(), 
    TimeSpan.FromDays(3));
+6
source

All Articles