public async Task StartAsync() { _log.WriteInfo(nameof(StartAsync), "", "Subscribing to the realm sessions..."); foreach (var realm in _realms) { realm.SessionCreated += _healthService.TraceWampSessionCreated; realm.SessionClosed += _healthService.TraceWampSessionClosed; realm.SessionClosed += (sender, args) => { _sessionCache.TryRemoveSessionId(args.SessionId); }; } _log.WriteInfo(nameof(StartAsync), "", "Starting subscribers..."); var tasks = _subscribers.Select(s => Task.Run(() => s.Start())); _cqrsEngine.StartSubscribers(); await Task.WhenAll(tasks); }