Ejemplo n.º 1
0
 private AzureQueueAdapterReceiver(QueueId queueId, AzureQueueDataManager queue)
 {
     if (queueId == null) throw new ArgumentNullException("queueId");
     if (queue == null) throw new ArgumentNullException("queue");
     
     Id = queueId;
     this.queue = queue;
 }
Ejemplo n.º 2
0
 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 AzureQueueDataManager(queueId.ToString(), deploymentId, dataConnectionString);
     return new AzureQueueAdapterReceiver(queueId, queue);
 }
Ejemplo n.º 3
0
 private AzureQueueAdapterReceiver(QueueId queueId, AzureQueueDataManager queue)
 {
     if (queueId == null) throw new ArgumentNullException("queueId");
     if (queue == null) throw new ArgumentNullException("queue");
     
     Id = queueId;
     this.queue = queue;
     logger = LogManager.GetLogger(GetType().Name, LoggerType.Provider);
 }
Ejemplo n.º 4
0
 public async Task Shutdown(TimeSpan timeout)
 {
     try
     {
         // await the last storage operation, so after we shutdown and stop this receiver we don't get async operation completions from pending storage operations.
         if (outstandingTask != null)
             await outstandingTask;
     }
     finally
     {
         // remember that we shut down so we never try to read from the queue again.
         queue = null;
     }
 }
        /// <summary>
        /// Helper method for testing.
        /// </summary>
        /// <param name="providerName"></param>
        /// <param name="deploymentId"></param>
        /// <param name="storageConnectionString"></param>
        /// <param name="logger"></param>
        /// <returns></returns>
        public static async Task DeleteAllUsedAzureQueues(string providerName, string deploymentId, string storageConnectionString, Logger logger)
        {
            if (deploymentId != null)
            {
                var queueMapper = new HashRingBasedStreamQueueMapper(AzureQueueAdapterFactory.DEFAULT_NUM_QUEUES, providerName);
                List<QueueId> allQueues = queueMapper.GetAllQueues().ToList();

                if (logger != null) logger.Info("About to delete all {0} Stream Queues\n", allQueues.Count);
                foreach (var queueId in allQueues)
                {
                    var manager = new AzureQueueDataManager(queueId.ToString(), deploymentId, storageConnectionString);
                    await manager.DeleteQueue();
                }
            }
        }
        /// <summary>
        /// Helper method for testing. Clears all messages in all the queues used by the specifed stream provider.
        /// </summary>
        /// <param name="providerName">The Azure Queue stream privider name.</param>
        /// <param name="deploymentId">The deployment ID hosting the stream provider.</param>
        /// <param name="storageConnectionString">The azure storage connection string.</param>
        public static async Task ClearAllUsedAzureQueues(string providerName, string deploymentId, string storageConnectionString)
        {
            if (deploymentId != null)
            {
                var queueMapper = new HashRingBasedStreamQueueMapper(AzureQueueAdapterFactory.NumQueuesDefaultValue, providerName);
                List<QueueId> allQueues = queueMapper.GetAllQueues().ToList();

                var deleteTasks = new List<Task>();
                foreach (var queueId in allQueues)
                {
                    var manager = new AzureQueueDataManager(queueId.ToString(), deploymentId, storageConnectionString);
                    deleteTasks.Add(manager.ClearQueue());
                }

                await Task.WhenAll(deleteTasks);
            }
        }
Ejemplo n.º 7
0
 private async Task<AzureQueueDataManager> GetTableManager(string qName)
 {
     AzureQueueDataManager manager = new AzureQueueDataManager(qName, DeploymentId, StorageTestConstants.DataConnectionString);
     await manager.InitQueueAsync();
     return manager;
 }