public Reader(IConsumerStreamFactory streamFactory, IFaultStrategy faultStrategy) { _stateManager = new StateManager <ReaderState>(ReaderState.Disconnected, ReaderState.Closed, ReaderState.ReachedEndOfTopic, ReaderState.Faulted); _streamFactory = streamFactory; _faultStrategy = faultStrategy; _connectTokenSource = new CancellationTokenSource(); Stream = new NotReadyStream(); _connectTask = Connect(_connectTokenSource.Token); _throwIfClosedOrFaulted = () => { }; }
public Consumer(IConsumerStreamFactory streamFactory, IFaultStrategy faultStrategy, bool setProxyState) { _executor = new Executor(OnException); _cachedCommandAck = new CommandAck(); _stateManager = new StateManager <ConsumerState>(ConsumerState.Disconnected, ConsumerState.Closed, ConsumerState.ReachedEndOfTopic, ConsumerState.Faulted); _streamFactory = streamFactory; _faultStrategy = faultStrategy; _setProxyState = setProxyState; _connectTokenSource = new CancellationTokenSource(); Stream = new NotReadyStream(); _connectTask = Connect(_connectTokenSource.Token); _throwIfClosedOrFaulted = () => { }; }