| | |
| | | |
| | | namespace WIDESEAWCS_QuartzJob.QuartzExtensions |
| | | { |
| | | /// <summary> |
| | | /// 启动程序自动开启调度服务 |
| | | /// </summary> |
| | | public class QuartzJobHostedService : IHostedService |
| | | { |
| | | private readonly ISchedulerCenter _schedulerCenter; |
| | |
| | | private readonly IDeviceProtocolDetailService _deviceProtocolDetailService; |
| | | private readonly QuartzNetExtension _quartzNetExtension; |
| | | |
| | | /// <summary> |
| | | /// 启动程序自动开启调度服务 |
| | | /// </summary> |
| | | public QuartzJobHostedService(ILogger<QuartzJobHostedService> logger, IDeviceInfoService deviceInfoService, IDispatchInfoService dispatchInfoService, ISchedulerCenter schedulerCenter, IDeviceProtocolDetailService deviceProtocolDetailService, QuartzNetExtension quartzNetExtension) |
| | | { |
| | | _logger = logger; |
| | |
| | | await _quartzNetExtension.StartAsync(); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 启动程序自动开启调度服务 |
| | | /// </summary> |
| | | public Task StopAsync(CancellationToken cancellationToken) |
| | | { |
| | | _logger.LogInformation("Stop QuartzJob Service!"); |