Compare commits
6 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| cdc373562e | |||
| f299e8952a | |||
| c54695c390 | |||
| c47fef80b3 | |||
| e2d2009cac | |||
| 53b422433c |
@@ -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.34.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);
|
||||||
|
|||||||
@@ -3,11 +3,17 @@ using LiteCharms.Features.Shop.Notifications.Events;
|
|||||||
|
|
||||||
namespace LiteCharmsScheduler.Workers
|
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)
|
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");
|
logger.LogInformation("Startup jobs scheduled");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,6 +7,7 @@
|
|||||||
"Host": "mail.litecharms.co.za",
|
"Host": "mail.litecharms.co.za",
|
||||||
"UseSsl": true
|
"UseSsl": true
|
||||||
},
|
},
|
||||||
|
"EmailProcessorCron": "0 */5 * * * ?",
|
||||||
"Monitoring": {
|
"Monitoring": {
|
||||||
"ApiKey": "",
|
"ApiKey": "",
|
||||||
"Address": "http://aspire-dashboard-service.aspire.svc.cluster.local:18889",
|
"Address": "http://aspire-dashboard-service.aspire.svc.cluster.local:18889",
|
||||||
@@ -15,7 +16,8 @@
|
|||||||
"Logging": {
|
"Logging": {
|
||||||
"LogLevel": {
|
"LogLevel": {
|
||||||
"Default": "Information",
|
"Default": "Information",
|
||||||
"Microsoft.AspNetCore": "Warning"
|
"Microsoft.AspNetCore": "Warning",
|
||||||
|
"Microsoft.EntityFrameworkCore": "Warning"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"AllowedHosts": "*"
|
"AllowedHosts": "*"
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ data:
|
|||||||
Email__Host: "mail.litecharms.co.za"
|
Email__Host: "mail.litecharms.co.za"
|
||||||
Email__Port: "465"
|
Email__Port: "465"
|
||||||
Email__UseSsl: "true"
|
Email__UseSsl: "true"
|
||||||
|
EmailProcessorCron: "0 */5 * * * ?"
|
||||||
---
|
---
|
||||||
apiVersion: v1
|
apiVersion: v1
|
||||||
kind: Secret
|
kind: Secret
|
||||||
@@ -51,7 +52,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
|
||||||
@@ -74,7 +75,7 @@ spec:
|
|||||||
envFrom:
|
envFrom:
|
||||||
- configMapRef:
|
- configMapRef:
|
||||||
name: scheduler-config
|
name: scheduler-config
|
||||||
env:
|
env:
|
||||||
- name: Email__Credentials__Password
|
- name: Email__Credentials__Password
|
||||||
valueFrom:
|
valueFrom:
|
||||||
secretKeyRef:
|
secretKeyRef:
|
||||||
|
|||||||
Reference in New Issue
Block a user