add quartz for jobs

configure auto-scan folder and create hls files job WIP
This commit is contained in:
Oleksandr Bezdieniezhnykh
2024-07-26 14:11:29 +03:00
parent 5e55210eac
commit 7807f5bc90
18 changed files with 179 additions and 28 deletions
+19 -2
View File
@@ -1,7 +1,10 @@
using System.Collections.Specialized;
using Azaion.Repository;
using Azaion.Repository.DTO;
using Azaion.Repository.DTO.Configs;
using Azaion.Video;
using Microsoft.Extensions.Options;
using Quartz;
using Serilog;
using Serilog.Events;
@@ -22,9 +25,23 @@ builder.Services.AddControllers();
builder.Services.AddEndpointsApiExplorer();
builder.Services.AddSwaggerGen();
builder.Services.Configure<FoldersConfig>(builder.Configuration.GetSection(nameof(FoldersConfig)));
builder.Services.Configure<ConnectionStrings>(builder.Configuration.GetSection(nameof(ConnectionStrings)));
builder.Services.AddSingleton<IDbFactory, DbFactory>(sp => new DbFactory(sp.GetService<IOptions<ConnectionStrings>>()!.Value.FraudDb!));
builder.Services.AddScoped<IVideoManager, VideoManager>();
builder.Services.AddScoped<IVideoRepository, VideoRepository>();
var connStr = builder.Configuration.Get<ConnectionStrings>();
builder.Services.AddQuartz(q =>
{
q.SchedulerId = "AzaionScheduler";
q.SchedulerName = "Azaion Scheduler";
q.UsePersistentStore(c =>
{
c.UseNewtonsoftJsonSerializer();
c.UseMySql(connStr.FraudDbMsSql);
});
});
var app = builder.Build();
@@ -37,4 +54,4 @@ if (app.Environment.IsDevelopment())
app.UseHttpsRedirection();
app.MapControllers();
app.Run();
app.Run();