KafkaSR/RPG.Services.Core/RPGServiceBase.cs
2024-01-30 02:49:21 +03:00

24 lines
595 B
C#

using Microsoft.Extensions.Hosting;
namespace RPG.Services.Core;
public abstract class RPGServiceBase : IHostedService
{
private readonly ServiceManager _serviceManager;
public RPGServiceBase(ServiceManager serviceManager)
{
_serviceManager = serviceManager;
}
public virtual Task StartAsync(CancellationToken cancellationToken)
{
_serviceManager.Start();
return Task.CompletedTask;
}
public virtual async Task StopAsync(CancellationToken cancellationToken)
{
await _serviceManager.ShutdownAsync();
}
}