diff --git a/LiteCharmsScheduler/LiteCharmsScheduler.csproj b/LiteCharmsScheduler/LiteCharmsScheduler.csproj
index 05cb3d5..8c9f43b 100644
--- a/LiteCharmsScheduler/LiteCharmsScheduler.csproj
+++ b/LiteCharmsScheduler/LiteCharmsScheduler.csproj
@@ -17,11 +17,12 @@
-
+
+
diff --git a/LiteCharmsScheduler/Program.cs b/LiteCharmsScheduler/Program.cs
index ae86b2e..509358b 100644
--- a/LiteCharmsScheduler/Program.cs
+++ b/LiteCharmsScheduler/Program.cs
@@ -1,12 +1,15 @@
using LiteCharms.Features.Extensions;
using LiteCharms.Features.Mediator;
using LiteCharmsScheduler.Workers;
-using Mediator;
using static LiteCharms.Features.Email.Extensions.Constants;
var builder = Host.CreateApplicationBuilder(args);
-builder.Services.AddMediator();
+builder.Services.AddMediator(options => options.Assemblies = new List
+ {
+ 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(LoggingPipelineBehavior<,>));
@@ -16,7 +19,7 @@ builder.Services.AddEmailServiceBus();
builder.Services.AddSalesServiceBus();
builder.Services.AddGeneralServiceBus();
-builder.Services.AddQuartzSchedulerClient(ShopSchedulerName, builder.Configuration);
+builder.Services.AddQuartzScheduler(ShopSchedulerName, builder.Configuration);
builder.Services.AddShopServices();
builder.Services.AddShopDatabase(builder.Configuration);
diff --git a/LiteCharmsScheduler/Workers/JobWorker.cs b/LiteCharmsScheduler/Workers/JobWorker.cs
index 6f37f52..88b2620 100644
--- a/LiteCharmsScheduler/Workers/JobWorker.cs
+++ b/LiteCharmsScheduler/Workers/JobWorker.cs
@@ -5,9 +5,13 @@ namespace LiteCharmsScheduler.Workers
{
public class JobWorker(IJobOrchestrator jobOrchestrator, ILogger logger) : BackgroundService
{
+ private const string emailProcessorCron = "0 */5 * * * ?";
+
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");
}
diff --git a/LiteCharmsScheduler/appsettings.json b/LiteCharmsScheduler/appsettings.json
index aec5c2e..350fcc2 100644
--- a/LiteCharmsScheduler/appsettings.json
+++ b/LiteCharmsScheduler/appsettings.json
@@ -15,7 +15,8 @@
"Logging": {
"LogLevel": {
"Default": "Information",
- "Microsoft.AspNetCore": "Warning"
+ "Microsoft.AspNetCore": "Warning",
+ "Microsoft.EntityFrameworkCore": "Warning"
}
},
"AllowedHosts": "*"
diff --git a/litecharms-scheduler-uat.yml b/litecharms-scheduler-uat.yml
index a7398d4..a9406a2 100644
--- a/litecharms-scheduler-uat.yml
+++ b/litecharms-scheduler-uat.yml
@@ -51,7 +51,7 @@ metadata:
namespace: litecharms-scheduler-uat
spec:
serviceName: "scheduler-worker-service"
- replicas: 3
+ replicas: 1
selector:
matchLabels:
app: scheduler