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
Copy file name to clipboardExpand all lines: README.md
+38-2Lines changed: 38 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -14,7 +14,7 @@
14
14
# NCronJob
15
15
A Job Scheduler sitting on top of `IHostedService` in dotnet.
16
16
17
-
Often times one finds themself between the simplicisty of the `BackgroundService`/`IHostedService` and the complexity of a full blown `Hangfire` or `Quartz` scheduler.
17
+
Often times one finds themself between the simplicity of the `BackgroundService`/`IHostedService` and the complexity of a full blown `Hangfire` or `Quartz` scheduler.
18
18
This library aims to fill that gap by providing a simple and easy to use job scheduler that can be used in any dotnet application and feels "native".
19
19
20
20
So no need for setting up a database, just schedule your stuff right away! The library gives you two ways of scheduling jobs:
@@ -26,7 +26,7 @@ So no need for setting up a database, just schedule your stuff right away! The l
26
26
-[x] The ability to instantly run a job
27
27
-[x] Parameterized jobs - instant as well as cron jobs!
28
28
-[x] Integrated in ASP.NET - Access your DI container like you would in any other service
29
-
-[] Get notified when a job is done (either successfully or with an error) - currently in development
29
+
-[x] Get notified when a job is done (either successfully or with an error).
30
30
31
31
## Not features
32
32
@@ -91,6 +91,42 @@ public class MyService
91
91
}
92
92
```
93
93
94
+
## Getting notified when a job is done
95
+
**NCronJob** provides a way to get notified when a job is done. For this, implement a `IJobNotificationHandler<TJob>` and register it in your DI container.
/// Classes implementing this interface can handle the notification of a job execution.
5
+
/// </summary>
6
+
publicinterfaceIJobNotificationHandler
7
+
{
8
+
/// <summary>
9
+
/// This method is invoked when a <see cref="IJob"/> is finished (either successfully or with an exception).
10
+
/// </summary>
11
+
/// <param name="context">The <see cref="JobExecutionContext"/> that was used for this run.</param>
12
+
/// <param name="exception">The exception that was thrown during the execution of the job. If the job was successful, this will be <c>null</c>.</param>
13
+
/// <param name="cancellationToken">The <see cref="CancellationToken"/> that can be used to cancel the notification.</param>
14
+
/// <remarks>
15
+
/// The method will be invoked with the same scope as the job itself.
0 commit comments