private RabbitMessageQueueAdapterReceiver(QueueId queueId, RabbitMessageQueueDataManager queue)
 {
     if (queueId == null)
         throw new ArgumentNullException("queueId");
     if (queue == null)
         throw new ArgumentNullException("queue");
     Id = queueId;
     _queue = queue;
 }
 public static IQueueAdapterReceiver Create(QueueId queueId, string dataConnectionString, string deploymentId)
 {
     if (queueId == null)
         throw new ArgumentNullException("queueId");
     if (string.IsNullOrEmpty(dataConnectionString))
         throw new ArgumentNullException("dataConnectionString");
     if (string.IsNullOrEmpty(deploymentId))
         throw new ArgumentNullException("deploymentId");
     var queue = new RabbitMessageQueueDataManager(queueId.ToString(), deploymentId, dataConnectionString);
     return new RabbitMessageQueueAdapterReceiver(queueId, queue);
 }
 public async Task Shutdown(TimeSpan timeout)
 {
     try
     {
         if (_outstandingTask != null) // await the last storage operation, so after we shutdown and stop this receiver we don't get async operation completions from pending storage operations.
             await _outstandingTask;
     }
     finally
     {
         _queue = null;  // remember that we shut down so we never try to read from the queue again.
     }
 }
 private RabbitMessageQueueAdapterReceiver(QueueId queueId, RabbitMessageQueueDataManager queue)
 {
     if (queueId == null)
     {
         throw new ArgumentNullException("queueId");
     }
     if (queue == null)
     {
         throw new ArgumentNullException("queue");
     }
     Id     = queueId;
     _queue = queue;
 }
 public async Task Shutdown(TimeSpan timeout)
 {
     try
     {
         if (_outstandingTask != null) // await the last storage operation, so after we shutdown and stop this receiver we don't get async operation completions from pending storage operations.
         {
             await _outstandingTask;
         }
     }
     finally
     {
         _queue = null;  // remember that we shut down so we never try to read from the queue again.
     }
 }
        public async Task QueueMessageBatchAsync <T>(Guid streamGuid, string streamNamespace, IEnumerable <T> events, StreamSequenceToken token,
                                                     Dictionary <string, object> requestContext)
        {
            var queueId = _streamQueueMapper.GetQueueForStream(streamGuid, streamNamespace);
            RabbitMessageQueueDataManager queue;

            if (!Queues.TryGetValue(queueId, out queue))
            {
                var tmpQueue = new RabbitMessageQueueDataManager(queueId.ToString(), DeploymentId, DataConnectionString);
                await tmpQueue.InitQueueAsync();

                queue = Queues.GetOrAdd(queueId, tmpQueue);
            }
            var cloudMsg = RabbitMessageQueueBatchContainer.ToCloudQueueMessage(streamGuid, streamNamespace, events, requestContext);
            await queue.AddQueueMessage(cloudMsg);
        }
        public static IQueueAdapterReceiver Create(QueueId queueId, string dataConnectionString, string deploymentId)
        {
            if (queueId == null)
            {
                throw new ArgumentNullException("queueId");
            }
            if (string.IsNullOrEmpty(dataConnectionString))
            {
                throw new ArgumentNullException("dataConnectionString");
            }
            if (string.IsNullOrEmpty(deploymentId))
            {
                throw new ArgumentNullException("deploymentId");
            }
            var queue = new RabbitMessageQueueDataManager(queueId.ToString(), deploymentId, dataConnectionString);

            return(new RabbitMessageQueueAdapterReceiver(queueId, queue));
        }