SportingSolutions.Udapi.Sdk.StreamSubscriber.StartConsuming C# (CSharp) Method

StartConsuming() public method

public StartConsuming ( string queueName ) : void
queueName string
return void
        public void StartConsuming(string queueName)
        {
            try
            {
                Model.BasicConsume(queueName, true, Consumer.Id, this);
            }
            catch (Exception e)
            {
                _logger.Error("Error starting stream for consumerId=" + Consumer.Id, e);
                throw;
            }
        }

Usage Example

        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;
            }
        }
All Usage Examples Of SportingSolutions.Udapi.Sdk.StreamSubscriber::StartConsuming