-
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathSendNotificationTask.cs
More file actions
53 lines (49 loc) · 1.79 KB
/
SendNotificationTask.cs
File metadata and controls
53 lines (49 loc) · 1.79 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
namespace ServiceBricks.Notification
{
/// <summary>
/// This is a background task that sends notification messages to the MessageProcessQueue service.
/// </summary>
public static partial class SendNotificationTask
{
/// <summary>
/// Queue the work to the background task queue.
/// </summary>
/// <param name="backgroundTaskQueue"></param>
public static void QueueWork(this ITaskQueue backgroundTaskQueue)
{
backgroundTaskQueue.Queue(new Detail());
}
/// <summary>
/// The detail class provides any additional information needed to perform the work.
/// In this case, no additional information is needed.
/// </summary>
public class Detail : ITaskDetail<Detail, Worker>
{
}
/// <summary>
/// The worker class performs the work detail.
/// </summary>
public class Worker : ITaskWork<Detail, Worker>
{
private readonly NotifyMessageWorkService _notifyMessageWorkService;
/// <summary>
/// Constructor.
/// </summary>
/// <param name="notifyMessageWorker"></param>
public Worker(NotifyMessageWorkService notifyMessageWorkService)
{
_notifyMessageWorkService = notifyMessageWorkService;
}
/// <summary>
/// Perform the work.
/// </summary>
/// <param name="detail"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
public async Task DoWork(Detail detail, CancellationToken cancellationToken)
{
await _notifyMessageWorkService.ExecuteAsync(cancellationToken);
}
}
}
}