Files
hrynco-notification-service/HrynCo.NotificationService.Worker/Program.cs
T
Anatolii Grynchuk b0996833bc feat: add RabbitMQ worker, contracts, usage UI in channels screen
- Add HrynCo.NotificationService.Contracts project with SendEmailMessage and NotificationResultMessage
- Add SendEmailConsumer (RabbitMQ worker) with reply-to pattern via CorrelationContext.ReplyTo
- Add SendEmailHandler owning SMTP send + usage increment as business logic
- Add GetChannelUsageSummaryHandler with single DB query via navigation property
- Merge usage stats inline into channels list (daily/monthly with progress bars)
- Refactor AdminChannelsController.Index to use GetChannelUsageSummaryQuery
- Add RabbitMQ service to docker-compose files
- Remove dead AdminChannelUsageController, ChannelUsageViewModel, ChannelUsageSummary

Ref: IT-628

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-05-02 14:00:58 +03:00

25 lines
826 B
C#

using HrynCo.NotificationService.DAL.EF;
using HrynCo.NotificationService.Services;
using HrynCo.NotificationService.Worker;
using Hrynco.RabbitMq;
using Microsoft.Extensions.Options;
var builder = Host.CreateApplicationBuilder(args);
builder.AddSerilog();
var appSettings = builder.Configuration
.GetSection(AppSettings.SectionName)
.Get<AppSettings>() ?? throw new InvalidOperationException("App settings are not configured.");
builder.Services.AddSingleton(appSettings);
builder.Services.AddNotificationDataAccess(appSettings.ConnectionString);
builder.Services.AddNotificationServices();
builder.Services.Configure<RabbitMqSettings>(
builder.Configuration.GetSection($"{AppSettings.SectionName}:RabbitMq"));
builder.Services.AddHostedService<SendEmailConsumer>();
var host = builder.Build();
host.Run();