Compare commits

...

4 Commits

Author SHA1 Message Date
khwezi c54695c390 Merge pull request 'Externalised email processor cron setting' (#21) from migration into master
Reviewed-on: #21
2026-05-16 00:43:16 +02:00
Khwezi Mngoma c47fef80b3 Externalised email processor cron setting
continuous-integration/drone/pr Build is passing
2026-05-16 00:42:47 +02:00
khwezi e2d2009cac Merge pull request 'Fixed email sending logic' (#20) from migration into master
Reviewed-on: #20
2026-05-16 00:33:04 +02:00
Khwezi Mngoma 53b422433c Fixed email sending logic
continuous-integration/drone/pr Build is passing
2026-05-16 00:32:22 +02:00
5 changed files with 22 additions and 9 deletions
@@ -17,11 +17,12 @@
<!-- Lite Charms Libraries -->
<ItemGroup>
<PackageReference Include="LiteCharms.Features" Version="1.27.0" />
<PackageReference Include="LiteCharms.Features" Version="1.32.0" />
</ItemGroup>
<!-- Shared Global Usings -->
<ItemGroup>
<Using Include="Quartz" />
<Using Include="Mediator" />
</ItemGroup>
</Project>
+6 -3
View File
@@ -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<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(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);
+8 -2
View File
@@ -3,11 +3,17 @@ using LiteCharms.Features.Shop.Notifications.Events;
namespace LiteCharmsScheduler.Workers
{
public class JobWorker(IJobOrchestrator jobOrchestrator, ILogger<JobWorker> logger) : BackgroundService
public class JobWorker(IJobOrchestrator jobOrchestrator, ILogger<JobWorker> logger, IConfiguration configuration) : BackgroundService
{
protected override async Task ExecuteAsync(CancellationToken stoppingToken)
{
await jobOrchestrator.ScheduleAsync(ProcessEmailNotificationsEvent.Create(), "0 */5 * * * ?", stoppingToken);
string? emailProcessorCron = !string.IsNullOrWhiteSpace(configuration.GetSection("EmailProcessorCron").Value)
? configuration.GetSection("EmailProcessorCron").Value
: "0 */4 * * * ?";
var emailProcessorJob = ProcessEmailNotificationsEvent.Create();
await jobOrchestrator.ScheduleAsync(emailProcessorJob, emailProcessorCron!, stoppingToken);
logger.LogInformation("Startup jobs scheduled");
}
+3 -1
View File
@@ -7,6 +7,7 @@
"Host": "mail.litecharms.co.za",
"UseSsl": true
},
"EmailProcessorCron": "0 */5 * * * ?",
"Monitoring": {
"ApiKey": "",
"Address": "http://aspire-dashboard-service.aspire.svc.cluster.local:18889",
@@ -15,7 +16,8 @@
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
"Microsoft.AspNetCore": "Warning",
"Microsoft.EntityFrameworkCore": "Warning"
}
},
"AllowedHosts": "*"
+3 -2
View File
@@ -17,6 +17,7 @@ data:
Email__Host: "mail.litecharms.co.za"
Email__Port: "465"
Email__UseSsl: "true"
EmailProcessorCron: "0 */5 * * * ?"
---
apiVersion: v1
kind: Secret
@@ -51,7 +52,7 @@ metadata:
namespace: litecharms-scheduler-uat
spec:
serviceName: "scheduler-worker-service"
replicas: 3
replicas: 1
selector:
matchLabels:
app: scheduler
@@ -74,7 +75,7 @@ spec:
envFrom:
- configMapRef:
name: scheduler-config
env:
env:
- name: Email__Credentials__Password
valueFrom:
secretKeyRef: