Esempio n. 1
0
        public async Task DeleteAllQueuesWithPrefix()
        {
            using (var client = ClientFactory.CreateSqsClient())
            {
                var creationTasks = new Task[12];
                for (var i = 0; i < 10; i++)
                {
                    creationTasks[i] = RetryCreateOnThrottle(client, $"deleteprefix-{i}", TimeSpan.FromSeconds(10), 6, queueNamePrefix: "DEV");
                }

                creationTasks[10] = RetryCreateOnThrottle(client, "deleteprefix-10", TimeSpan.FromSeconds(10), 6);
                creationTasks[11] = Task.Delay(TimeSpan.FromSeconds(60));

                await Task.WhenAll(creationTasks)
                .ConfigureAwait(false);
            }

            await QueueDeletionUtils.DeleteAllQueues(queueNamePrefix : "DEV")
            .ConfigureAwait(false);

            Assert.IsTrue(await QueueExistenceUtils.Exists("deleteprefix-10"));

            for (var i = 0; i < 10; i++)
            {
                Assert.IsFalse(await QueueExistenceUtils.Exists($"DEVdeleteprefix-{i}"));
            }
        }
Esempio n. 2
0
        public async Task DeleteAllQueuesWhenMoreThanAThousandQueues() // Takes several minutes!
        {
            using (var client = ClientFactory.CreateSqsClient())
            {
                var creationTasks = new Task[2001];
                for (var i = 0; i < 2000; i++)
                {
                    creationTasks[i] = RetryCreateOnThrottle(client, $"deletemore2000-{i}", TimeSpan.FromSeconds(10), 6);
                }

                creationTasks[2000] = Task.Delay(TimeSpan.FromSeconds(60));

                await Task.WhenAll(creationTasks)
                .ConfigureAwait(false);
            }

            await QueueDeletionUtils.DeleteAllQueues()
            .ConfigureAwait(false);

            for (var i = 0; i < 2000; i++)
            {
                Assert.IsFalse(await QueueExistenceUtils.Exists($"deletemore2000-{i}"));
            }
        }