Skip to content

eyupgevenim/ScheduleTask

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Schedule Task Design With Hangfire (.Net 5.0 )

ITask.cs interface

public interface ITask
{
    void Execute();
}

MailSenderTask.cs class

public class MailSenderTask : ITask
{
    public void Execute()
    {
        //TODO:....
        Thread.Sleep(500);
    }
}

Task description ScheduleTasks scop in appsettings.json

{
    "Type": "Scheduler.Tasks.Email.MailSenderTask, Scheduler",
    "Name": "Mail Sender Task",
    "CronExpression": "*/5 * * ? * *",
    "Enabled": true
}
  • Type : "[class full name], [assembly name]"
  • CronExpression : A cron expression is a string consisting of six or seven subexpressions (fields) that describe individual details of the schedule. These fields, separated by white space, can contain any of the allowed values with various combinations of the allowed characters for that field.

installation in docker

_>docker-compose -f docker-compose.yml up --build 

For Cron Expression

wikipedia
Hangfire Cronos
free formatter

About

Schedule Task Design With Hangfire (.Net 5.0 )

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published