Rename Feedser to Concelier
This commit is contained in:
30
src/StellaOps.Concelier.Exporter.Json/JsonExportJob.cs
Normal file
30
src/StellaOps.Concelier.Exporter.Json/JsonExportJob.cs
Normal file
@@ -0,0 +1,30 @@
|
||||
using System;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using StellaOps.Concelier.Core.Jobs;
|
||||
|
||||
namespace StellaOps.Concelier.Exporter.Json;
|
||||
|
||||
public sealed class JsonExportJob : IJob
|
||||
{
|
||||
public const string JobKind = "export:json";
|
||||
public static readonly TimeSpan DefaultTimeout = TimeSpan.FromMinutes(10);
|
||||
public static readonly TimeSpan DefaultLeaseDuration = TimeSpan.FromMinutes(5);
|
||||
|
||||
private readonly JsonFeedExporter _exporter;
|
||||
private readonly ILogger<JsonExportJob> _logger;
|
||||
|
||||
public JsonExportJob(JsonFeedExporter exporter, ILogger<JsonExportJob> logger)
|
||||
{
|
||||
_exporter = exporter ?? throw new ArgumentNullException(nameof(exporter));
|
||||
_logger = logger ?? throw new ArgumentNullException(nameof(logger));
|
||||
}
|
||||
|
||||
public async Task ExecuteAsync(JobExecutionContext context, CancellationToken cancellationToken)
|
||||
{
|
||||
_logger.LogInformation("Executing JSON export job {RunId}", context.RunId);
|
||||
await _exporter.ExportAsync(context.Services, cancellationToken).ConfigureAwait(false);
|
||||
_logger.LogInformation("Completed JSON export job {RunId}", context.RunId);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user