[FA-9] Need to add persistence layer
This commit is contained in:
52
FictionArchive.Service.SchedulerService/Program.cs
Normal file
52
FictionArchive.Service.SchedulerService/Program.cs
Normal file
@@ -0,0 +1,52 @@
|
||||
using FictionArchive.Service.SchedulerService.GraphQL;
|
||||
using FictionArchive.Service.SchedulerService.Services;
|
||||
using FictionArchive.Service.Shared.Extensions;
|
||||
using FictionArchive.Service.Shared.Services.EventBus.Implementations;
|
||||
using Quartz;
|
||||
|
||||
namespace FictionArchive.Service.SchedulerService;
|
||||
|
||||
public class Program
|
||||
{
|
||||
public static void Main(string[] args)
|
||||
{
|
||||
var builder = WebApplication.CreateBuilder(args);
|
||||
|
||||
// Services
|
||||
builder.Services.AddDefaultGraphQl<Query, Mutation>();
|
||||
builder.Services.AddHealthChecks();
|
||||
builder.Services.AddTransient<JobManagerService>();
|
||||
|
||||
#region Event Bus
|
||||
|
||||
builder.Services.AddRabbitMQ(opt =>
|
||||
{
|
||||
builder.Configuration.GetSection("RabbitMQ").Bind(opt);
|
||||
});
|
||||
|
||||
#endregion
|
||||
|
||||
#region Quartz
|
||||
|
||||
builder.Services.AddQuartz(opt =>
|
||||
{
|
||||
opt.UseMicrosoftDependencyInjectionJobFactory();
|
||||
});
|
||||
builder.Services.AddQuartzHostedService(opt =>
|
||||
{
|
||||
opt.WaitForJobsToComplete = true;
|
||||
});
|
||||
|
||||
#endregion
|
||||
|
||||
var app = builder.Build();
|
||||
|
||||
app.UseHttpsRedirection();
|
||||
|
||||
app.MapHealthChecks("/healthz");
|
||||
|
||||
app.MapGraphQL();
|
||||
|
||||
app.Run();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user