You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

41 lines
1.1 KiB

2 years ago
using System;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.Extensions.Hosting;
using Volo.Abp;
namespace Win_in.Sfs.Wms.DataExchange.Fawtyg.EosAgent;
public class EosAgentHostedService : IHostedService
{
private readonly IAbpApplicationWithExternalServiceProvider _application;
private readonly IServiceProvider _serviceProvider;
private readonly EosAgentService _eosAgentService;
public EosAgentHostedService(
IAbpApplicationWithExternalServiceProvider application,
IServiceProvider serviceProvider,
EosAgentService eosAgentService)
{
_application = application;
_serviceProvider = serviceProvider;
_eosAgentService = eosAgentService;
}
public Task StartAsync(CancellationToken cancellationToken)
{
_application.Initialize(_serviceProvider);
_eosAgentService.Start();
return Task.CompletedTask;
}
public Task StopAsync(CancellationToken cancellationToken)
{
_application.Shutdown();
return Task.CompletedTask;
}
}