Skip to content

Commit 2f553fc

Browse files
committed
edit readme
1 parent dee9e61 commit 2f553fc

File tree

1 file changed

+21
-6
lines changed

1 file changed

+21
-6
lines changed

README.md

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,16 +21,29 @@ We can use the attribute `RecurringJobAttribute` to assign the interface/instanc
2121
public class RecurringJobService
2222
{
2323
[RecurringJob("*/1 * * * *")]
24-
[DisplayName("InstanceTestJob")]
2524
[Queue("jobs")]
25+
public void TestJob1(PerformContext context)
26+
{
27+
context.WriteLine($"{DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss")} TestJob1 Running ...");
28+
}
29+
[RecurringJob("*/2 * * * *", RecurringJobId = "TestJob2")]
30+
[Queue("jobs")]
31+
public void TestJob2(PerformContext context)
32+
{
33+
context.WriteLine($"{DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss")} TestJob2 Running ...");
34+
}
35+
[RecurringJob("*/2 * * * *", "China Standard Time", "jobs")]
36+
public void TestJob3(PerformContext context)
37+
{
38+
context.WriteLine($"{DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss")} TestJob3 Running ...");
39+
}
40+
[RecurringJob("*/5 * * * *", "jobs")]
2641
public void InstanceTestJob(PerformContext context)
2742
{
2843
context.WriteLine($"{DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss")} InstanceTestJob Running ...");
2944
}
3045

31-
[RecurringJob("*/5 * * * *")]
32-
[DisplayName("JobStaticTest")]
33-
[Queue("jobs")]
46+
[RecurringJob("*/6 * * * *", "UTC", "jobs")]
3447
public static void StaticTestJob(PerformContext context)
3548
{
3649
context.WriteLine($"{DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss")} StaticTestJob Running ...");
@@ -112,10 +125,12 @@ queue | *[optional]* The specified queue name , default value is `default`.
112125
job-data | *[optional]* Similar to the [quartz.net](http://www.quartz-scheduler.net/) `JobDataMap`, it is can be deserialized to the type `Dictionary<string,object>`.
113126
enable | *[optional]* Whether the `RecurringJob` can be added/updated, default value is true, if false `RecurringJob` will be deleted automatically.
114127

115-
*To the json token `job-data`, we can use extension method to get data with specified key from `PerformContext` when recurring job running.*
128+
*To the json token `job-data`, we can use extension method to get/set data with specified key from `PerformContext` when recurring job running.*
116129

117130
```csharp
118-
var runningTimes = context.GetJobData<int>("RunningTimes");
131+
var intVal = context.GetJobData<int>("IntVal");
132+
133+
context.SetJobData("IntVal", ++intVal);
119134
```
120135

121136
## Building RecurringJob

0 commit comments

Comments
 (0)