Created Windows Service
This commit is contained in:
.gitignore
FabApprovalWorkerService
FabApprovalWorkerService.csprojFabApprovalWorkerService.csproj.user
Models
Program.csServices
SetupScripts
Workers
FabApprovalWorkerServiceTests
@ -8,7 +8,7 @@ using Quartz;
|
||||
|
||||
using System.Net.Mail;
|
||||
|
||||
WebApplicationBuilder builder = WebApplication.CreateBuilder(args);
|
||||
HostApplicationBuilder builder = Host.CreateApplicationBuilder(args);
|
||||
|
||||
builder.Logging.ClearProviders();
|
||||
builder.Logging.SetMinimumLevel(LogLevel.Trace);
|
||||
@ -36,11 +36,7 @@ builder.Services.AddQuartz(q => {
|
||||
q.AddTrigger(opts => opts
|
||||
.ForJob(pendingOOOStatusJob)
|
||||
.WithIdentity("Pending OOO status trigger")
|
||||
.WithSimpleSchedule(x => x
|
||||
.WithIntervalInMinutes(10)
|
||||
.RepeatForever()
|
||||
)
|
||||
.StartNow()
|
||||
.WithCronSchedule(CronScheduleBuilder.DailyAtHourAndMinute(0, 0))
|
||||
);
|
||||
|
||||
JobKey expiredOOOStatusJob = new JobKey("Expired OOO status job");
|
||||
@ -50,6 +46,16 @@ builder.Services.AddQuartz(q => {
|
||||
q.AddTrigger(opts => opts
|
||||
.ForJob(expiredOOOStatusJob)
|
||||
.WithIdentity("Expired OOO status trigger")
|
||||
.WithCronSchedule(CronScheduleBuilder.DailyAtHourAndMinute(0, 0))
|
||||
);
|
||||
|
||||
JobKey expiringTECNJob = new JobKey("Expiring TECN job");
|
||||
q.AddJob<ExpiringTECNWorker>(opts => opts
|
||||
.WithIdentity(expiringTECNJob)
|
||||
);
|
||||
q.AddTrigger(opts => opts
|
||||
.ForJob(expiringTECNJob)
|
||||
.WithIdentity("Expiring TECN trigger")
|
||||
.WithSimpleSchedule(x => x
|
||||
.WithIntervalInMinutes(10)
|
||||
.RepeatForever()
|
||||
@ -62,6 +68,11 @@ builder.Services.AddQuartzHostedService(opt => {
|
||||
opt.WaitForJobsToComplete = true;
|
||||
});
|
||||
|
||||
WebApplication app = builder.Build();
|
||||
builder.Services.AddWindowsService(options => {
|
||||
options.ServiceName = "Fab Approval Worker Service";
|
||||
});
|
||||
builder.Services.AddHostedService<WindowsService>();
|
||||
|
||||
IHost app = builder.Build();
|
||||
|
||||
app.Run();
|
||||
|
Reference in New Issue
Block a user