Calling methods with delay

Sometimes you may want to postpone a method invocation; for example, to send an email to newly registered users a day after their registration. To do this, just call the BackgroundJob.Schedule method and pass the needed time span:

    () => Console.WriteLine("Hello, world"),

Hangfire Server periodically check the schedule to enqueue scheduled jobs to their queues, allowing workers to perform them. By default, check interval is equal to 15 seconds, but you can change it, just pass the corresponding option to the BackgroundJobServer ctor.

var options = new BackgroundJobServerOptions
    SchedulePollingInterval = TimeSpan.FromMinutes(1)

var server = new BackgroundJobServer(options);

If you are processing your jobs inside an ASP.NET application, you should be warned about some setting that may prevent your scheduled jobs to be performed in-time. To avoid that behavior, perform the following steps:

Please use Hangfire Forum for long questions or questions with source code.