public async Task Run() { var lifeTime = Continer.Resolve <IHostLifetime>(); var hostAppLifetime = (ApplicationLifetime)Continer.Resolve <IHostApplicationLifetime>(); await using (hostAppLifetime.ApplicationStopping.Register(() => ActorSystem.Terminate())) { await lifeTime.WaitForStartAsync(ActorSystem); hostAppLifetime.NotifyStarted(); ActorSystem.RegisterOnTermination(hostAppLifetime.NotifyStopped); await lifeTime.ShutdownTask; await Task.WhenAny(ActorSystem.WhenTerminated, Task.Delay(TimeSpan.FromSeconds(60))); Log.CloseAndFlush(); } }
public void Dispose() => Continer.Dispose();