Dispose() public method

public Dispose ( ) : void
return void
        protected virtual void AddConsumerToQueue(IConsumer consumer)
        {
            var queue = consumer.GetQueueDetails();

            if (queue == null || string.IsNullOrEmpty(queue.Name))
            {
                throw new Exception("Invalid queue details");
            }


            if (!CanPerformChannelOperations)
            {
                throw new InvalidOperationException("Cannot accept new consumers at the moment");
            }

            var model = _streamConnection.CreateModel();
            StreamSubscriber subscriber = null;

            try
            {
                subscriber = new StreamSubscriber(model, consumer, Dispatcher);
                subscriber.StartConsuming(queue.Name);
            }
            catch
            {
                if (subscriber != null)
                {
                    subscriber.Dispose();
                }

                throw;
            }
        }
        protected virtual void AddConsumerToQueue(IConsumer consumer)
        {

            var queue = consumer.GetQueueDetails();
            if (queue == null || string.IsNullOrEmpty(queue.Name))
                throw new Exception("Invalid queue details");


            if(!CanPerformChannelOperations)
                throw new InvalidOperationException("Cannot accept new consumers at the moment");

            var model = _streamConnection.CreateModel();
            StreamSubscriber subscriber = null;

            try
            {                 
                subscriber = new StreamSubscriber(model, consumer, Dispatcher);
                subscriber.StartConsuming(queue.Name);
            }
            catch
            {
                if (subscriber != null)
                    subscriber.Dispose();

                throw;
            }
        }