I want to convert QUARTZ jobs to hangfire
There I have a class with Execute method.
How to call this method in Hangfire. I try something like
public static string CRON_EXP = "0 30 1 ? * *";
RecurringJob.AddOrUpdate("CheckStudentAgeJob", () => CheckStudentAgeJob(), CRON_EXP);
class is
public class CheckStudentAgeJob {
public void Execute()
{
//...
}
}
but syntax is not correct. How can I do this?
You are trying to call a class instead of a method. It should be:
public static string CRON_EXP = "0 30 1 ? * *";
RecurringJob.AddOrUpdate("CheckStudentAgeJob",
() => new CheckStudentAgeJob().Execute(), CRON_EXP);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With