private SQSAdapterReceiver(QueueId queueId, SQSStorage 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); }
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 SQSStorage(queueId.ToString(), dataConnectionString, deploymentId); return new SQSAdapterReceiver(queueId, queue); }
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> /// Async method to delete all used queques, for specific provider and deploymentId /// </summary> /// <param name="providerName"></param> /// <param name="deploymentId"></param> /// <param name="storageConnectionString"></param> /// <returns> Task object for this async method </returns> public static async Task DeleteAllUsedQueues(string providerName, string deploymentId, string storageConnectionString) { if (deploymentId != null) { var queueMapper = new HashRingBasedStreamQueueMapper(SQSAdapterFactory.NumQueuesDefaultValue, providerName); List<QueueId> allQueues = queueMapper.GetAllQueues().ToList(); var deleteTasks = new List<Task>(); foreach (var queueId in allQueues) { var manager = new SQSStorage(queueId.ToString(), storageConnectionString, deploymentId); manager.InitQueueAsync().Wait(); deleteTasks.Add(manager.DeleteQueue()); } await Task.WhenAll(deleteTasks); } }