52 lines
1.3 KiB
C#
52 lines
1.3 KiB
C#
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();
|
|
}
|
|
} |