This commit is contained in:
@@ -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>
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -5,9 +5,13 @@ namespace LiteCharmsScheduler.Workers
|
||||
{
|
||||
public class JobWorker(IJobOrchestrator jobOrchestrator, ILogger<JobWorker> 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");
|
||||
}
|
||||
|
||||
@@ -15,7 +15,8 @@
|
||||
"Logging": {
|
||||
"LogLevel": {
|
||||
"Default": "Information",
|
||||
"Microsoft.AspNetCore": "Warning"
|
||||
"Microsoft.AspNetCore": "Warning",
|
||||
"Microsoft.EntityFrameworkCore": "Warning"
|
||||
}
|
||||
},
|
||||
"AllowedHosts": "*"
|
||||
|
||||
@@ -51,7 +51,7 @@ metadata:
|
||||
namespace: litecharms-scheduler-uat
|
||||
spec:
|
||||
serviceName: "scheduler-worker-service"
|
||||
replicas: 3
|
||||
replicas: 1
|
||||
selector:
|
||||
matchLabels:
|
||||
app: scheduler
|
||||
|
||||
Reference in New Issue
Block a user