8aee35c123
- HrynCo.NotificationService.Core (class library) - HrynCo.NotificationService.Api (ASP.NET Core Web API) - HrynCo.NotificationService.Worker (Worker Service) - HrynCo.NotificationService.Core.Tests (xUnit) - HrynCo.NotificationService.Api.IntegrationTests (xUnit) - Api and Worker reference Core - Test projects reference their respective targets Ref: IT-628 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
17 lines
504 B
C#
17 lines
504 B
C#
namespace HrynCo.NotificationService.Worker;
|
|
|
|
public class Worker(ILogger<Worker> logger) : BackgroundService
|
|
{
|
|
protected override async Task ExecuteAsync(CancellationToken stoppingToken)
|
|
{
|
|
while (!stoppingToken.IsCancellationRequested)
|
|
{
|
|
if (logger.IsEnabled(LogLevel.Information))
|
|
{
|
|
logger.LogInformation("Worker running at: {time}", DateTimeOffset.Now);
|
|
}
|
|
await Task.Delay(1000, stoppingToken);
|
|
}
|
|
}
|
|
}
|