-
Notifications
You must be signed in to change notification settings - Fork 39
Expand file tree
/
Copy pathHeartbeatJob.cs
More file actions
31 lines (24 loc) · 895 Bytes
/
Copy pathHeartbeatJob.cs
File metadata and controls
31 lines (24 loc) · 895 Bytes
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
#region copyright
// Autofac Quartz integration
// https://github.com/alphacloud/Autofac.Extras.Quartz
// Licensed under MIT license.
// Copyright (c) 2014-2026 Alphacloud.Net
#endregion
// ReSharper disable once CheckNamespace
namespace SimpleService.Jobs;
using AppServices;
public class HeartbeatJob : IJob
{
readonly IHeartbeatService _heartbeat;
readonly IScopedDependency _scopedDependency;
public HeartbeatJob(IHeartbeatService heartbeat, IScopedDependency scopedDependency)
{
_heartbeat = heartbeat ?? throw new ArgumentNullException(nameof(heartbeat));
_scopedDependency = scopedDependency ?? throw new ArgumentNullException(nameof(scopedDependency));
}
public Task Execute(IJobExecutionContext context)
{
_heartbeat.UpdateServiceState($"alive, scope: {_scopedDependency.Scope}");
return Task.CompletedTask;
}
}