private RabbitMessageQueueAdapterReceiver(QueueId queueId, RabbitMessageQueueDataManager queue)
        {
            if (queueId == null) throw new ArgumentNullException(nameof(queueId));
            if (queue == null) throw new ArgumentNullException(nameof(queue));

            this.Id = queueId;
            this._queue = queue;
        }
        public static IQueueAdapterReceiver Create(QueueId queueId, string rabbitMqConnectionString, string deploymentId = "")
        {
            if (queueId == null) throw new ArgumentNullException(nameof(queueId));
            if (String.IsNullOrEmpty(rabbitMqConnectionString)) throw new ArgumentNullException(nameof(rabbitMqConnectionString));

            var queue = new RabbitMessageQueueDataManager(queueId.ToString(), deploymentId, rabbitMqConnectionString);

            return new RabbitMessageQueueAdapterReceiver(queueId, queue);
        }
 public async Task Shutdown(TimeSpan timeout)
 {
     try
     {
         if (_outstandingTask != null)
             await _outstandingTask;
     }
     finally
     {
         _queue = null;  // remember that we shut down so we never try to read from the queue again.
     }
 }