2023-05-24 12:21:19 +00:00
|
|
|
|
using Elsa.Http.Contracts;
|
2023-04-17 13:23:05 +00:00
|
|
|
|
using Microsoft.Extensions.Hosting;
|
|
|
|
|
|
|
|
|
|
|
|
namespace Elsa.Http.HostedServices;
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Update the route table based on workflow triggers and bookmarks.
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
public class UpdateRouteTableHostedService : BackgroundService
|
|
|
|
|
|
{
|
2023-05-24 12:21:19 +00:00
|
|
|
|
private readonly IRouteTableUpdater _routeTableUpdater;
|
2023-04-17 13:23:05 +00:00
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Initializes a new instance of the <see cref="UpdateRouteTableHostedService"/> class.
|
|
|
|
|
|
/// </summary>
|
2023-05-24 12:21:19 +00:00
|
|
|
|
public UpdateRouteTableHostedService(IRouteTableUpdater routeTableUpdater)
|
2023-04-17 13:23:05 +00:00
|
|
|
|
{
|
2023-05-24 12:21:19 +00:00
|
|
|
|
_routeTableUpdater = routeTableUpdater;
|
2023-04-17 13:23:05 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <inheritdoc />
|
|
|
|
|
|
protected override async Task ExecuteAsync(CancellationToken stoppingToken)
|
|
|
|
|
|
{
|
2023-05-24 12:21:19 +00:00
|
|
|
|
await _routeTableUpdater.UpdateAsync(stoppingToken);
|
2023-04-17 13:23:05 +00:00
|
|
|
|
}
|
|
|
|
|
|
}
|