public void Start() { if (_started) { return; } try { _serviceContainer.Start(); _consumerPool = new ThreadPoolConsumerPool(this, _eventChannel, _receiveTimeout) { MaximumConsumerCount = MaximumConsumerThreads, }; _consumerPool.Start(); } catch (Exception) { if (_consumerPool != null) { _consumerPool.Dispose(); } throw; } _started = true; }
protected virtual void Dispose(bool disposing) { if (_disposed) { return; } if (disposing) { if (_consumerPool != null) { _consumerPool.Stop(); _consumerPool.Dispose(); _consumerPool = null; } if (_serviceContainer != null) { _serviceContainer.Stop(); _serviceContainer.Dispose(); _serviceContainer = null; } if (ControlBus != this) { ControlBus.Dispose(); } _unsubscribeEventDispatchers(); InboundPipeline.Dispose(); InboundPipeline = null; OutboundPipeline.Dispose(); OutboundPipeline = null; if (_eventAggregatorScope != null) { _eventAggregatorScope.Dispose(); _eventAggregatorScope = null; } _eventAggregator = null; Endpoint = null; if (_counters != null) { _counters.Dispose(); _counters = null; } if (PoisonEndpoint != null) { PoisonEndpoint = null; } } _disposed = true; }
protected virtual void Dispose(bool disposing) { if (_disposed) { return; } if (disposing) { if (_consumerPool != null) { _consumerPool.Stop(); _consumerPool.Dispose(); _consumerPool = null; } if (_serviceContainer != null) { _serviceContainer.Stop(); _serviceContainer.Dispose(); _serviceContainer = null; } if (ControlBus != this) { ControlBus.Dispose(); } if (_performanceCounterConnection != null) { _performanceCounterConnection.Dispose(); _performanceCounterConnection = null; } _eventChannel = null; Endpoint = null; if (_counters != null) { _counters.Dispose(); _counters = null; } EndpointCache.Dispose(); } _disposed = true; }