🎉 Initialize the DysonNetwork.Messager service
This commit is contained in:
21
DysonNetwork.Messager/Startup/ScheduledJobsConfiguration.cs
Normal file
21
DysonNetwork.Messager/Startup/ScheduledJobsConfiguration.cs
Normal file
@@ -0,0 +1,21 @@
|
||||
using Quartz;
|
||||
|
||||
namespace DysonNetwork.Messager.Startup;
|
||||
|
||||
public static class ScheduledJobsConfiguration
|
||||
{
|
||||
public static IServiceCollection AddAppScheduledJobs(this IServiceCollection services)
|
||||
{
|
||||
services.AddQuartz(q =>
|
||||
{
|
||||
q.AddJob<AppDatabaseRecyclingJob>(opts => opts.WithIdentity("AppDatabaseRecycling"));
|
||||
q.AddTrigger(opts => opts
|
||||
.ForJob("AppDatabaseRecycling")
|
||||
.WithIdentity("AppDatabaseRecyclingTrigger")
|
||||
.WithCronSchedule("0 0 0 * * ?"));
|
||||
});
|
||||
services.AddQuartzHostedService(q => q.WaitForJobsToComplete = true);
|
||||
|
||||
return services;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user