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
|
@ -1,5 +1,7 @@
|
|||
using System;
|
||||
using API.Extensions;
|
||||
using API.Middleware;
|
||||
using Hangfire;
|
||||
using Microsoft.AspNetCore.Builder;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
|
@ -33,7 +35,7 @@ namespace API
|
|||
}
|
||||
|
||||
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
|
||||
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
|
||||
public void Configure(IApplicationBuilder app, IBackgroundJobClient backgroundJobs, IWebHostEnvironment env)
|
||||
{
|
||||
app.UseMiddleware<ExceptionMiddleware>();
|
||||
|
||||
|
@ -42,6 +44,9 @@ namespace API
|
|||
app.UseSwagger();
|
||||
app.UseSwaggerUI(c => c.SwaggerEndpoint("/swagger/v1/swagger.json", "API v1"));
|
||||
}
|
||||
|
||||
app.UseHangfireDashboard();
|
||||
backgroundJobs.Enqueue(() => Console.WriteLine("Hello world from Hangfire!"));
|
||||
|
||||
app.UseHttpsRedirection();
|
||||
|
||||
|
@ -57,6 +62,7 @@ namespace API
|
|||
app.UseEndpoints(endpoints =>
|
||||
{
|
||||
endpoints.MapControllers();
|
||||
endpoints.MapHangfireDashboard();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue