You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This repo is the extension for [Hangfire](https://github.com/HangfireIO/Hangfire) to build `RecurringJob` automatically. We can use the attribute `RecurringJobAttribute` to assign the interface/instance/static method.
8
+
This repo is the extension for [Hangfire](https://github.com/HangfireIO/Hangfire) to build `RecurringJob` automatically.
9
9
When app start, `RecurringJob` will be added/updated automatically.
10
+
There is two ways to build `RecurringJob`.
11
+
12
+
-`RecurringJobAttribute` attribute
13
+
- Json Configuration
14
+
15
+
## Using RecurringJobAttribute
16
+
17
+
We can use the attribute `RecurringJobAttribute` to assign the interface/instance/static method.
18
+
10
19
11
20
```csharp
12
21
publicclassRecurringJobService
@@ -29,4 +38,107 @@ public class RecurringJobService
29
38
}
30
39
```
31
40
32
-
More details [here](https://github.com/icsharp/Hangfire.Topshelf).
41
+
## Json Configuration
42
+
43
+
It is similar to [quartz.net](http://www.quartz-scheduler.net/), We also define the unified interface `IRecurringJob`.
44
+
Recurring jobs must impl the specified interface like this.
timezone | *[optional]* Default value is `TimeZoneInfo.Local`.
111
+
queue | *[optional]* The specified queue name , default value is `default`.
112
+
job-data | *[optional]* Likely to the [quartz.net](http://www.quartz-scheduler.net/)`JobDataMap`, it is can be deserialized to the type `Dictionary<string,object>`.
113
+
enable | *[optional]* Whether the `RecurringJob` can be added/updated, default value is true, if false `RecurringJob` will be deleted automatically.
114
+
115
+
*To the json token `job-data`, we can use extension method to get data with specified key from `PerformContext` when recurring job running.*
//using json config file to build RecurringJob automatically.
135
+
x.UseRecurringJob("recurringjob.json");
136
+
//using RecurringJobAttribute to build RecurringJob automatically.
137
+
x.UseRecurringJob(typeof(RecurringJobService));
138
+
139
+
x.UseDefaultActivator();
140
+
});
141
+
}
142
+
```
143
+
144
+
*For the json configuration file, we can monitor the file change and reload `RecurringJob` dynamically by passing the parameter `reloadOnChange = true`.*
0 commit comments