Merge pull request 'Fixed email sending logic' (#20) from migration into master
Reviewed-on: #20
This commit was merged in pull request #20.
This commit is contained in:
@@ -17,11 +17,12 @@
|
|||||||
|
|
||||||
<!-- Lite Charms Libraries -->
|
<!-- Lite Charms Libraries -->
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="LiteCharms.Features" Version="1.27.0" />
|
<PackageReference Include="LiteCharms.Features" Version="1.32.0" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<!-- Shared Global Usings -->
|
<!-- Shared Global Usings -->
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Using Include="Quartz" />
|
<Using Include="Quartz" />
|
||||||
|
<Using Include="Mediator" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
||||||
|
|||||||
@@ -1,12 +1,15 @@
|
|||||||
using LiteCharms.Features.Extensions;
|
using LiteCharms.Features.Extensions;
|
||||||
using LiteCharms.Features.Mediator;
|
using LiteCharms.Features.Mediator;
|
||||||
using LiteCharmsScheduler.Workers;
|
using LiteCharmsScheduler.Workers;
|
||||||
using Mediator;
|
|
||||||
using static LiteCharms.Features.Email.Extensions.Constants;
|
using static LiteCharms.Features.Email.Extensions.Constants;
|
||||||
|
|
||||||
var builder = Host.CreateApplicationBuilder(args);
|
var builder = Host.CreateApplicationBuilder(args);
|
||||||
|
|
||||||
builder.Services.AddMediator();
|
builder.Services.AddMediator(options => options.Assemblies = new List<AssemblyReference>
|
||||||
|
{
|
||||||
|
typeof(Program).Assembly,
|
||||||
|
typeof(LiteCharms.Features.Shop.Notifications.Events.ProcessEmailNotificationsEvent).Assembly
|
||||||
|
}.AsReadOnly());
|
||||||
|
|
||||||
builder.Services.AddScoped(typeof(IPipelineBehavior<,>), typeof(TelemetryPipelineBehavior<,>));
|
builder.Services.AddScoped(typeof(IPipelineBehavior<,>), typeof(TelemetryPipelineBehavior<,>));
|
||||||
builder.Services.AddScoped(typeof(IPipelineBehavior<,>), typeof(LoggingPipelineBehavior<,>));
|
builder.Services.AddScoped(typeof(IPipelineBehavior<,>), typeof(LoggingPipelineBehavior<,>));
|
||||||
@@ -16,7 +19,7 @@ builder.Services.AddEmailServiceBus();
|
|||||||
|
|
||||||
builder.Services.AddSalesServiceBus();
|
builder.Services.AddSalesServiceBus();
|
||||||
builder.Services.AddGeneralServiceBus();
|
builder.Services.AddGeneralServiceBus();
|
||||||
builder.Services.AddQuartzSchedulerClient(ShopSchedulerName, builder.Configuration);
|
builder.Services.AddQuartzScheduler(ShopSchedulerName, builder.Configuration);
|
||||||
|
|
||||||
builder.Services.AddShopServices();
|
builder.Services.AddShopServices();
|
||||||
builder.Services.AddShopDatabase(builder.Configuration);
|
builder.Services.AddShopDatabase(builder.Configuration);
|
||||||
|
|||||||
@@ -5,9 +5,13 @@ namespace LiteCharmsScheduler.Workers
|
|||||||
{
|
{
|
||||||
public class JobWorker(IJobOrchestrator jobOrchestrator, ILogger<JobWorker> logger) : BackgroundService
|
public class JobWorker(IJobOrchestrator jobOrchestrator, ILogger<JobWorker> logger) : BackgroundService
|
||||||
{
|
{
|
||||||
|
private const string emailProcessorCron = "0 */5 * * * ?";
|
||||||
|
|
||||||
protected override async Task ExecuteAsync(CancellationToken stoppingToken)
|
protected override async Task ExecuteAsync(CancellationToken stoppingToken)
|
||||||
{
|
{
|
||||||
await jobOrchestrator.ScheduleAsync(ProcessEmailNotificationsEvent.Create(), "0 */5 * * * ?", stoppingToken);
|
var emailProcessorJob = ProcessEmailNotificationsEvent.Create();
|
||||||
|
|
||||||
|
await jobOrchestrator.ScheduleAsync(emailProcessorJob, emailProcessorCron, stoppingToken);
|
||||||
|
|
||||||
logger.LogInformation("Startup jobs scheduled");
|
logger.LogInformation("Startup jobs scheduled");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,7 +15,8 @@
|
|||||||
"Logging": {
|
"Logging": {
|
||||||
"LogLevel": {
|
"LogLevel": {
|
||||||
"Default": "Information",
|
"Default": "Information",
|
||||||
"Microsoft.AspNetCore": "Warning"
|
"Microsoft.AspNetCore": "Warning",
|
||||||
|
"Microsoft.EntityFrameworkCore": "Warning"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"AllowedHosts": "*"
|
"AllowedHosts": "*"
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ metadata:
|
|||||||
namespace: litecharms-scheduler-uat
|
namespace: litecharms-scheduler-uat
|
||||||
spec:
|
spec:
|
||||||
serviceName: "scheduler-worker-service"
|
serviceName: "scheduler-worker-service"
|
||||||
replicas: 3
|
replicas: 1
|
||||||
selector:
|
selector:
|
||||||
matchLabels:
|
matchLabels:
|
||||||
app: scheduler
|
app: scheduler
|
||||||
|
|||||||
Reference in New Issue
Block a user