/// <summary> /// Creates a new instance /// </summary> public LiveSubscriptionEnumerator(SubscriptionDataConfig dataConfig, IDataQueueHandler dataQueueHandler, EventHandler handler) { _requestedSymbol = dataConfig.Symbol; _underlyingEnumerator = dataQueueHandler.SubscribeWithMapping(dataConfig, handler, out _currentConfig); // for any mapping event we will re subscribe dataConfig.NewSymbol += (_, _) => { dataQueueHandler.Unsubscribe(_currentConfig); _previousEnumerator = _underlyingEnumerator; var oldSymbol = _currentConfig.Symbol; _underlyingEnumerator = dataQueueHandler.SubscribeWithMapping(dataConfig, handler, out _currentConfig); Log.Trace($"LiveSubscriptionEnumerator({_requestedSymbol}): " + $"resubscribing old: '{oldSymbol.Value}' new '{_currentConfig.Symbol.Value}'"); }; }