Get Recurring Jobs?


#1

I am using recurring jobs to call into a WCF service to send emails.

I would like to create a UI for our users to be able to add/update recurring jobs as they please. (i.e. - change the time of day that their emails can be sent)

JobStorage.Current.GetMonitoringApi() seems to have all information about the background jobs which I’m not currently using at the moment.

Is it possible to get a list of RecurringJobs or a RecurringJob by ID?

I’m using the latest Hangfire 1.4

Thank you


#2

Actually, I just found it:

StorageConnectionExtensions.GetRecurringJobs();


#3

Sethiron, Hi :)!
You can save the recurring jobs ids on some place too. And when user need trigger or change the job, you can use RecurringJob.AddOrUpdate again. I Think this is better approach. That way, grants that if the job don’t exists for any reasons, he will create the job again.


#4

List<RecurringJobDto> recurringJobs = Hangfire.JobStorage.Current.GetConnection().GetRecurringJobs();


#5

I cannot compile JobStorage.Current.GetConnection().GetRecurringJobs();
IStorageConnection got no definition for GetRecurringJobs() says VS.
What am I missing?


#6

[EDIT] got it, namespace is Hangfire.Storage