Added Hangfire with LiteDB for a task running system. At the most basic, this allows us to monitor tasks running on the system (during dev only) and run tasks on a reoccuring or ad-hoc basis.
This commit is contained in:
parent
e1c1719b6a
commit
4fd9943b91
22 changed files with 69 additions and 43 deletions
|
@ -3,6 +3,8 @@ using API.Helpers;
|
|||
using API.Interfaces;
|
||||
using API.Services;
|
||||
using AutoMapper;
|
||||
using Hangfire;
|
||||
using Hangfire.LiteDB;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
|
@ -14,6 +16,7 @@ namespace API.Extensions
|
|||
public static IServiceCollection AddApplicationServices(this IServiceCollection services, IConfiguration config)
|
||||
{
|
||||
services.AddAutoMapper(typeof(AutoMapperProfiles).Assembly);
|
||||
services.AddScoped<ITaskScheduler, TaskScheduler>();
|
||||
services.AddScoped<IUserRepository, UserRepository>();
|
||||
services.AddScoped<ITokenService, TokenService>();
|
||||
services.AddScoped<IDirectoryService, DirectoryService>();
|
||||
|
@ -23,6 +26,14 @@ namespace API.Extensions
|
|||
options.UseSqlite(config.GetConnectionString("DefaultConnection"));
|
||||
});
|
||||
|
||||
services.AddHangfire(configuration => configuration
|
||||
.UseSimpleAssemblyNameTypeSerializer()
|
||||
.UseRecommendedSerializerSettings()
|
||||
.UseLiteDbStorage());
|
||||
|
||||
// Add the processing server as IHostedService
|
||||
services.AddHangfireServer();
|
||||
|
||||
return services;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue