public async Task TagsAreNotAppliedIfNoneAreProvided() { // Arrange var sut = new SqsQueueByName(RegionEndpoint.EUWest1, QueueName, _client, 3, NullLoggerFactory.Instance); // Act await sut.EnsureQueueAndErrorQueueExistAndAllAttributesAreUpdatedAsync(new SqsReadConfiguration(SubscriptionType.ToTopic), CancellationToken.None); // Assert await _client.Received(0).TagQueueAsync(Arg.Any <TagQueueRequest>()); }
public async Task <SqsQueueByName> EnsureQueueExistsAsync(string region, SqsReadConfiguration queueConfig) { var regionEndpoint = RegionEndpoint.GetBySystemName(region); var sqsclient = _awsClientFactory.GetAwsClientFactory().GetSqsClient(regionEndpoint); var queue = _queueCache.TryGetFromCache(region, queueConfig.QueueName); if (queue != null) { return(queue); } queue = new SqsQueueByName(regionEndpoint, queueConfig.QueueName, sqsclient, queueConfig.RetryCountBeforeSendingToErrorQueue, _loggerFactory); await queue.EnsureQueueAndErrorQueueExistAndAllAttributesAreUpdatedAsync(queueConfig).ConfigureAwait(false); _queueCache.AddToCache(region, queue.QueueName, queue); return(queue); }
public QueueWithAsyncStartup <SqsQueueByName> EnsureQueueExists( string region, SqsReadConfiguration queueConfig) { var regionEndpoint = RegionEndpoint.GetBySystemName(region); var sqsclient = _awsClientFactory.GetAwsClientFactory().GetSqsClient(regionEndpoint); var queue = new SqsQueueByName(regionEndpoint, queueConfig.QueueName, sqsclient, queueConfig.RetryCountBeforeSendingToErrorQueue, _loggerFactory); var startupTask = queue.EnsureQueueAndErrorQueueExistAndAllAttributesAreUpdatedAsync(queueConfig); // This startupTask is intentionally not awaited, as it will be run when the bus is started. return(new QueueWithAsyncStartup <SqsQueueByName>(startupTask, queue)); }
public QueueWithAsyncStartup EnsureQueueExists( string region, SqsReadConfiguration queueConfig) { var regionEndpoint = RegionEndpoint.GetBySystemName(region); var sqsClient = _awsClientFactory.GetAwsClientFactory().GetSqsClient(regionEndpoint); #pragma warning disable 618 var queue = new SqsQueueByName(regionEndpoint, queueConfig.QueueName, sqsClient, queueConfig.RetryCountBeforeSendingToErrorQueue, _loggerFactory); #pragma warning restore 618 var startupTask = new Func <Task>(() => queue.EnsureQueueAndErrorQueueExistAndAllAttributesAreUpdatedAsync(queueConfig)); return(new QueueWithAsyncStartup(startupTask, queue)); }
public async Task TagsAreAppliedToParentAndErrorQueues() { // Arrange var sut = new SqsQueueByName(RegionEndpoint.EUWest1, QueueName, _client, 3, NullLoggerFactory.Instance); var config = new SqsReadConfiguration(SubscriptionType.ToTopic) { Tags = new Dictionary <string, string> { ["TagOne"] = "tag-one", ["TagTwo"] = "tag-two" } }; // Act await sut.EnsureQueueAndErrorQueueExistAndAllAttributesAreUpdatedAsync(config, CancellationToken.None); // Assert await _client.Received(1).TagQueueAsync(Arg.Is <TagQueueRequest>(req => req.QueueUrl == QueueUrl && req.Tags == config.Tags)); }