Exemple #1
0
        public async Task CreateQueuesForEndpointDefaultMaxTTL(string delayedDeliveryMethod)
        {
            var randomName     = Path.GetFileNameWithoutExtension(Path.GetRandomFileName());
            var endpointName   = $"mycreatedefaultendpoint-{randomName}";
            var errorQueueName = $"mycreatedefaulterror-{randomName}";
            var auditQueueName = $"mycreatedefaultaudit-{randomName}";

            try
            {
                await CreateEndpointQueues.CreateQueuesForEndpoint(endpointName, delayedDeliveryMethod : delayedDeliveryMethod)
                .ConfigureAwait(false);

                await QueueCreationUtils.CreateQueue(
                    queueName : errorQueueName)
                .ConfigureAwait(false);

                await QueueCreationUtils.CreateQueue(
                    queueName : auditQueueName)
                .ConfigureAwait(false);

                await AssertQueuesExist(endpointName, errorQueueName, auditQueueName, TimeSpan.FromDays(4), delayedDeliveryMethod : delayedDeliveryMethod)
                .ConfigureAwait(false);
            }
            finally
            {
                await DeleteEndpointQueues.DeleteQueuesForEndpoint(endpointName, delayedDeliveryMethod : delayedDeliveryMethod)
                .ConfigureAwait(false);

                await QueueDeletionUtils.DeleteQueue(errorQueueName)
                .ConfigureAwait(false);

                await QueueDeletionUtils.DeleteQueue(auditQueueName)
                .ConfigureAwait(false);
            }
        }
Exemple #2
0
        public async Task CreateQueuesForEndpointWithRetries()
        {
            var randomName     = Path.GetFileNameWithoutExtension(Path.GetRandomFileName());
            var endpointName   = $"mycreateprefixendpoint-{randomName}";
            var errorQueueName = $"mycreateprefixerror-{randomName}";
            var auditQueueName = $"mycreateprefixaudit-{randomName}";

            try
            {
                await CreateEndpointQueues.CreateQueuesForEndpoint(endpointName, includeRetries : true)
                .ConfigureAwait(false);

                await QueueCreationUtils.CreateQueue(
                    queueName : errorQueueName)
                .ConfigureAwait(false);

                await QueueCreationUtils.CreateQueue(
                    queueName : auditQueueName)
                .ConfigureAwait(false);

                await AssertQueuesExist(endpointName, errorQueueName, auditQueueName, TimeSpan.FromDays(4), includeRetries : true)
                .ConfigureAwait(false);
            }
            finally
            {
                await DeleteEndpointQueues.DeleteQueuesForEndpoint(endpointName, includeRetries : true)
                .ConfigureAwait(false);

                await QueueDeletionUtils.DeleteQueue(errorQueueName)
                .ConfigureAwait(false);

                await QueueDeletionUtils.DeleteQueue(auditQueueName)
                .ConfigureAwait(false);
            }
        }
Exemple #3
0
        QueueDeletionUtilsUsage()
        {
            #region msmq-delete-queues-shared-usage

            QueueDeletionUtils.DeleteQueue(queueName: "error");
            QueueDeletionUtils.DeleteQueue(queueName: "audit");

            #endregion
        }
Exemple #4
0
        public async Task CreateQueues_Powershell(string delayedDeliveryMethod)
        {
            var randomName     = Path.GetFileNameWithoutExtension(Path.GetRandomFileName());
            var endpointName   = $"createqueues-powershell-{randomName}";
            var errorQueueName = $"createqueueserror-powershell-{randomName}";
            var auditQueueName = $"createqueuesaudit-powershell-{randomName}";

            var state = new State();
            IEndpointInstance endpoint = null;

            try
            {
                var scriptPath = Path.Combine(TestContext.CurrentContext.TestDirectory, "QueueCreation/QueueCreation.ps1");
                using (var powerShell = PowerShell.Create())
                {
                    powerShell.AddScript(File.ReadAllText(scriptPath));
                    powerShell.Invoke();
                    var command = powerShell.AddCommand("CreateQueuesForEndpoint");
                    command.AddParameter("EndpointName", endpointName);
                    command.AddParameter("IncludeRetries");
                    command.AddParameter("DelayedDeliveryMethod", delayedDeliveryMethod);
                    command.Invoke();

                    command = powerShell.AddCommand("CreateQueue");
                    command.AddParameter("QueueName", errorQueueName);
                    command.Invoke();

                    command = powerShell.AddCommand("CreateQueue");
                    command.AddParameter("QueueName", auditQueueName);
                    command.Invoke();
                }

                endpoint = await StartEndpoint(state, endpointName, errorQueueName, auditQueueName, delayedDeliveryMethod).ConfigureAwait(false);

                var messageToSend = new MessageToSend();
                await endpoint.SendLocal(messageToSend).ConfigureAwait(false);

                Assert.IsTrue(await state.Signal.Task.ConfigureAwait(false));
            }
            finally
            {
                if (endpoint != null)
                {
                    await endpoint.Stop().ConfigureAwait(false);
                }

                await DeleteEndpointQueues.DeleteQueuesForEndpoint(endpointName, includeRetries : true, delayedDeliveryMethod : delayedDeliveryMethod)
                .ConfigureAwait(false);

                await QueueDeletionUtils.DeleteQueue(errorQueueName)
                .ConfigureAwait(false);

                await QueueDeletionUtils.DeleteQueue(auditQueueName)
                .ConfigureAwait(false);
            }
        }
        public async Task CreateQueuesForEndpointWithPrefix_Powershell()
        {
            var endpointName   = "mycreateprefixendpoint-powershell";
            var errorQueueName = "mycreateprefixerror-powershell";
            var auditQueueName = "mycreateprefixaudit-powershell";

            await DeleteEndpointQueues.DeleteQueuesForEndpoint(endpointName, queueNamePrefix : "DEV")
            .ConfigureAwait(false);

            await QueueDeletionUtils.DeleteQueue(errorQueueName, queueNamePrefix : "DEV")
            .ConfigureAwait(false);

            await QueueDeletionUtils.DeleteQueue(auditQueueName, queueNamePrefix : "DEV")
            .ConfigureAwait(false);

            try
            {
                var scriptPath = Path.Combine(TestContext.CurrentContext.TestDirectory, "QueueCreation/QueueCreation.ps1");
                using (var powerShell = PowerShell.Create())
                {
                    powerShell.AddScript(File.ReadAllText(scriptPath));
                    powerShell.Invoke();
                    var command = powerShell.AddCommand("CreateQueuesForEndpoint");
                    command.AddParameter("EndpointName", endpointName);
                    command.AddParameter("QueueNamePrefix", "DEV");
                    command.AddParameter("IncludeRetries");
                    command.Invoke();

                    command = powerShell.AddCommand("CreateQueue");
                    command.AddParameter("QueueName", errorQueueName);
                    command.AddParameter("QueueNamePrefix", "DEV");
                    command.Invoke();

                    command = powerShell.AddCommand("CreateQueue");
                    command.AddParameter("QueueName", auditQueueName);
                    command.AddParameter("QueueNamePrefix", "DEV");
                    command.Invoke();
                }

                await AssertQueuesExist(endpointName, errorQueueName, auditQueueName, TimeSpan.FromDays(4), queueNamePrefix : "DEV")
                .ConfigureAwait(false);
            }
            finally
            {
                await DeleteEndpointQueues.DeleteQueuesForEndpoint(endpointName, queueNamePrefix : "DEV")
                .ConfigureAwait(false);

                await QueueDeletionUtils.DeleteQueue(errorQueueName, queueNamePrefix : "DEV")
                .ConfigureAwait(false);

                await QueueDeletionUtils.DeleteQueue(auditQueueName, queueNamePrefix : "DEV")
                .ConfigureAwait(false);
            }
        }
        public async Task CreateQueuesForEndpointWithOverridenMaxTTL_Powershell()
        {
            var maxTimeToLive  = TimeSpan.FromDays(1);
            var endpointName   = "mycreateendpoint-powershell";
            var errorQueueName = "mycreateerror-powershell";
            var auditQueueName = "mycreateaudit-powershell";

            await DeleteEndpointQueues.DeleteQueuesForEndpoint(endpointName)
            .ConfigureAwait(false);

            await QueueDeletionUtils.DeleteQueue(errorQueueName)
            .ConfigureAwait(false);

            await QueueDeletionUtils.DeleteQueue(auditQueueName)
            .ConfigureAwait(false);

            try
            {
                var scriptPath = Path.Combine(TestContext.CurrentContext.TestDirectory, "QueueCreation/QueueCreation.ps1");
                using (var powerShell = PowerShell.Create())
                {
                    powerShell.AddScript(File.ReadAllText(scriptPath));
                    powerShell.Invoke();
                    var command = powerShell.AddCommand("CreateQueuesForEndpoint");
                    command.AddParameter("EndpointName", endpointName);
                    command.AddParameter("MaxTimeToLive", maxTimeToLive.ToString("G", CultureInfo.InvariantCulture));
                    command.Invoke();

                    command = powerShell.AddCommand("CreateQueue");
                    command.AddParameter("QueueName", errorQueueName);
                    command.AddParameter("MaxTimeToLive", maxTimeToLive.ToString("G", CultureInfo.InvariantCulture));
                    command.Invoke();

                    command = powerShell.AddCommand("CreateQueue");
                    command.AddParameter("QueueName", auditQueueName);
                    command.AddParameter("MaxTimeToLive", maxTimeToLive.ToString("G", CultureInfo.InvariantCulture));
                    command.Invoke();
                }

                await AssertQueuesExist(endpointName, errorQueueName, auditQueueName, maxTimeToLive)
                .ConfigureAwait(false);
            }
            finally
            {
                await DeleteEndpointQueues.DeleteQueuesForEndpoint(endpointName)
                .ConfigureAwait(false);

                await QueueDeletionUtils.DeleteQueue(errorQueueName)
                .ConfigureAwait(false);

                await QueueDeletionUtils.DeleteQueue(auditQueueName)
                .ConfigureAwait(false);
            }
        }
        public static void DeleteQueuesForEndpoint(string endpointName)
        {
            // main queue
            QueueDeletionUtils.DeleteQueue(endpointName);

            // timeout queue
            QueueDeletionUtils.DeleteQueue($"{endpointName}.timeouts");

            // timeout dispatcher queue
            QueueDeletionUtils.DeleteQueue($"{endpointName}.timeoutsdispatcher");
        }
Exemple #8
0
        QueueDeletionUtilsUsage()
        {
            #region rabbit-delete-queues-shared-usage

            QueueDeletionUtils.DeleteQueue(
                uri: "amqp://*****:*****@localhost:5672",
                queueName: "error");
            QueueDeletionUtils.DeleteQueue(
                uri: "amqp://*****:*****@localhost:5672",
                queueName: "audit");

            #endregion
        }
Exemple #9
0
        public async Task SendLargePowerShell()
        {
            var randomName     = Path.GetFileNameWithoutExtension(Path.GetRandomFileName());
            var endpointName   = $"sendlargepowershell-{randomName}";
            var errorQueueName = $"sendlargepowershell-{randomName}-error";

            var state = new State();
            IEndpointInstance endpoint = null;

            try
            {
                endpoint = await StartEndpoint(state, endpointName, errorQueueName).ConfigureAwait(false);

                var message = @"{ Property: 'Value' }";

                var headers = new Dictionary <string, string>
                {
                    { "NServiceBus.EnclosedMessageTypes", typeof(MessageToSend).FullName },
                    { "NServiceBus.MessageId", Guid.NewGuid().ToString() }
                };

                var scriptPath = Path.Combine(TestContext.CurrentContext.TestDirectory, @"NativeSend\NativeSend.ps1");
                using (var powerShell = PowerShell.Create())
                {
                    powerShell.AddScript(File.ReadAllText(scriptPath));
                    powerShell.Invoke();
                    var command = powerShell.AddCommand("SendLargeMessage");
                    command.AddParameter("QueueName", endpointName);
                    command.AddParameter("S3Prefix", "test");
                    command.AddParameter("BucketName", SqsTransportConfigurationExtensions.S3BucketName);
                    command.AddParameter("MessageBody", message);
                    command.AddParameter("Headers", headers);
                    command.Invoke();
                }

                Assert.AreEqual("Value", await state.Signal.Task.ConfigureAwait(false));
            }
            finally
            {
                if (endpoint != null)
                {
                    await endpoint.Stop().ConfigureAwait(false);
                }

                await DeleteEndpointQueues.DeleteQueuesForEndpoint(endpointName, includeRetries : true)
                .ConfigureAwait(false);

                await QueueDeletionUtils.DeleteQueue(errorQueueName)
                .ConfigureAwait(false);
            }
        }
        public static void DeleteQueuesForEndpoint(string endpointName)
        {
            // main queue
            QueueDeletionUtils.DeleteQueue(endpointName);

            // timeout queue
            QueueDeletionUtils.DeleteQueue($"{endpointName}.timeouts");

            // timeout dispatcher queue
            QueueDeletionUtils.DeleteQueue($"{endpointName}.timeoutsdispatcher");

            // retries queue
            // TODO: Only required in Versions 5 and below
            QueueDeletionUtils.DeleteQueue($"{endpointName}.retries");
        }
        public async Task CreateQueuesForEndpointWithOverridenMaxTTL()
        {
            var maxTimeToLive  = TimeSpan.FromDays(1);
            var endpointName   = "mycreateendpoint";
            var errorQueueName = "mycreateerror";
            var auditQueueName = "mycreateaudit";

            await DeleteEndpointQueues.DeleteQueuesForEndpoint(endpointName)
            .ConfigureAwait(false);

            await QueueDeletionUtils.DeleteQueue(errorQueueName)
            .ConfigureAwait(false);

            await QueueDeletionUtils.DeleteQueue(auditQueueName)
            .ConfigureAwait(false);

            try
            {
                await CreateEndpointQueues.CreateQueuesForEndpoint(
                    endpointName : endpointName,
                    maxTimeToLive : maxTimeToLive)
                .ConfigureAwait(false);

                await QueueCreationUtils.CreateQueue(
                    queueName : errorQueueName,
                    maxTimeToLive : maxTimeToLive)
                .ConfigureAwait(false);

                await QueueCreationUtils.CreateQueue(
                    queueName : auditQueueName,
                    maxTimeToLive : maxTimeToLive)
                .ConfigureAwait(false);

                await AssertQueuesExist(endpointName, errorQueueName, auditQueueName, maxTimeToLive)
                .ConfigureAwait(false);
            }
            finally
            {
                await DeleteEndpointQueues.DeleteQueuesForEndpoint(endpointName)
                .ConfigureAwait(false);

                await QueueDeletionUtils.DeleteQueue(errorQueueName)
                .ConfigureAwait(false);

                await QueueDeletionUtils.DeleteQueue(auditQueueName)
                .ConfigureAwait(false);
            }
        }
Exemple #12
0
        public async Task CreateQueues(string delayedDeliveryMethod)
        {
            var randomName     = Path.GetFileNameWithoutExtension(Path.GetRandomFileName());
            var endpointName   = $"createqueues-{randomName}";
            var errorQueueName = $"createqueues-{randomName}-error";
            var auditQueueName = $"createqueues-{randomName}-audit";

            var state = new State();
            IEndpointInstance endpoint = null;

            try
            {
                await CreateEndpointQueues.CreateQueuesForEndpoint(endpointName, includeRetries : true, delayedDeliveryMethod : delayedDeliveryMethod)
                .ConfigureAwait(false);

                await QueueCreationUtils.CreateQueue(
                    queueName : errorQueueName)
                .ConfigureAwait(false);

                await QueueCreationUtils.CreateQueue(
                    queueName : auditQueueName)
                .ConfigureAwait(false);

                endpoint = await StartEndpoint(state, endpointName, errorQueueName, auditQueueName, delayedDeliveryMethod).ConfigureAwait(false);

                var messageToSend = new MessageToSend();
                await endpoint.SendLocal(messageToSend).ConfigureAwait(false);

                Assert.IsTrue(await state.Signal.Task.ConfigureAwait(false));
            }
            finally
            {
                if (endpoint != null)
                {
                    await endpoint.Stop().ConfigureAwait(false);
                }

                await DeleteEndpointQueues.DeleteQueuesForEndpoint(endpointName, includeRetries : true, delayedDeliveryMethod : delayedDeliveryMethod)
                .ConfigureAwait(false);

                await QueueDeletionUtils.DeleteQueue(errorQueueName)
                .ConfigureAwait(false);

                await QueueDeletionUtils.DeleteQueue(auditQueueName)
                .ConfigureAwait(false);
            }
        }
        public async Task CreateQueuesForEndpointWithPrefix()
        {
            var endpointName   = "mycreateprefixendpoint";
            var errorQueueName = "mycreateprefixerror";
            var auditQueueName = "mycreateprefixaudit";

            await DeleteEndpointQueues.DeleteQueuesForEndpoint(endpointName, queueNamePrefix : "DEV")
            .ConfigureAwait(false);

            await QueueDeletionUtils.DeleteQueue(errorQueueName, queueNamePrefix : "DEV")
            .ConfigureAwait(false);

            await QueueDeletionUtils.DeleteQueue(auditQueueName, queueNamePrefix : "DEV")
            .ConfigureAwait(false);

            try
            {
                await CreateEndpointQueues.CreateQueuesForEndpoint(endpointName, queueNamePrefix : "DEV")
                .ConfigureAwait(false);

                await QueueCreationUtils.CreateQueue(
                    queueName : errorQueueName,
                    queueNamePrefix : "DEV")
                .ConfigureAwait(false);

                await QueueCreationUtils.CreateQueue(
                    queueName : auditQueueName,
                    queueNamePrefix : "DEV")
                .ConfigureAwait(false);

                await AssertQueuesExist(endpointName, errorQueueName, auditQueueName, TimeSpan.FromDays(4), queueNamePrefix : "DEV")
                .ConfigureAwait(false);
            }
            finally
            {
                await DeleteEndpointQueues.DeleteQueuesForEndpoint(endpointName, queueNamePrefix : "DEV")
                .ConfigureAwait(false);

                await QueueDeletionUtils.DeleteQueue(errorQueueName, queueNamePrefix : "DEV")
                .ConfigureAwait(false);

                await QueueDeletionUtils.DeleteQueue(auditQueueName, queueNamePrefix : "DEV")
                .ConfigureAwait(false);
            }
        }
Exemple #14
0
        public async Task SendLarge()
        {
            var randomName     = Path.GetFileNameWithoutExtension(Path.GetRandomFileName());
            var endpointName   = $"sendlarge-{randomName}";
            var errorQueueName = $"sendlarge-{randomName}-error";

            var state = new State();
            IEndpointInstance endpoint = null;

            try
            {
                endpoint = await StartEndpoint(state, endpointName, errorQueueName).ConfigureAwait(false);

                var message = @"{ Property: 'Value' }";

                var headers = new Dictionary <string, string>
                {
                    { "NServiceBus.EnclosedMessageTypes", typeof(MessageToSend).FullName },
                    { "NServiceBus.MessageId", Guid.NewGuid().ToString() }
                };

                using (var s3Client = ClientFactory.CreateS3Client())
                    using (var client = ClientFactory.CreateSqsClient())
                    {
                        await NativeSend.SendLargeMessage(client, s3Client, endpointName, "test", SqsTransportConfigurationExtensions.S3BucketName, message, headers)
                        .ConfigureAwait(false);
                    }

                Assert.AreEqual("Value", await state.Signal.Task.ConfigureAwait(false));
            }
            finally
            {
                if (endpoint != null)
                {
                    await endpoint.Stop().ConfigureAwait(false);
                }

                await DeleteEndpointQueues.DeleteQueuesForEndpoint(endpointName, includeRetries : true)
                .ConfigureAwait(false);

                await QueueDeletionUtils.DeleteQueue(errorQueueName)
                .ConfigureAwait(false);
            }
        }
        public async Task CreateQueuesForEndpointWithRetries()
        {
            var endpointName   = "mycreateretriesendpoint";
            var errorQueueName = "mycreateretrieserror";
            var auditQueueName = "mycreateretriesaudit";

            await DeleteEndpointQueues.DeleteQueuesForEndpoint(endpointName, includeRetries : true)
            .ConfigureAwait(false);

            await QueueDeletionUtils.DeleteQueue(errorQueueName)
            .ConfigureAwait(false);

            await QueueDeletionUtils.DeleteQueue(auditQueueName)
            .ConfigureAwait(false);

            try
            {
                await CreateEndpointQueues.CreateQueuesForEndpoint(endpointName, includeRetries : true)
                .ConfigureAwait(false);

                await QueueCreationUtils.CreateQueue(
                    queueName : errorQueueName)
                .ConfigureAwait(false);

                await QueueCreationUtils.CreateQueue(
                    queueName : auditQueueName)
                .ConfigureAwait(false);

                await AssertQueuesExist(endpointName, errorQueueName, auditQueueName, TimeSpan.FromDays(4), includeRetries : true)
                .ConfigureAwait(false);
            }
            finally
            {
                await DeleteEndpointQueues.DeleteQueuesForEndpoint(endpointName, includeRetries : true)
                .ConfigureAwait(false);

                await QueueDeletionUtils.DeleteQueue(errorQueueName)
                .ConfigureAwait(false);

                await QueueDeletionUtils.DeleteQueue(auditQueueName)
                .ConfigureAwait(false);
            }
        }
Exemple #16
0
        public async Task CreateQueuesForEndpointDefaultMaxTTL_Powershell(string delayedDeliveryMethod)
        {
            var randomName     = Path.GetFileNameWithoutExtension(Path.GetRandomFileName());
            var endpointName   = $"mycreatedefaultendpoint-{randomName}-powershell";
            var errorQueueName = $"mycreatedefaulterror-{randomName}-powershell";
            var auditQueueName = $"mycreatedefaultaudit-{randomName}-powershell";

            try
            {
                var scriptPath = Path.Combine(TestContext.CurrentContext.TestDirectory, "QueueCreation/QueueCreation.ps1");
                using (var powerShell = PowerShell.Create())
                {
                    powerShell.AddScript(File.ReadAllText(scriptPath));
                    powerShell.Invoke();
                    var command = powerShell.AddCommand("CreateQueuesForEndpoint");
                    command.AddParameter("EndpointName", endpointName);
                    command.AddParameter("DelayedDeliveryMethod", delayedDeliveryMethod);
                    command.Invoke();

                    command = powerShell.AddCommand("CreateQueue");
                    command.AddParameter("QueueName", errorQueueName);
                    command.Invoke();

                    command = powerShell.AddCommand("CreateQueue");
                    command.AddParameter("QueueName", auditQueueName);
                    command.Invoke();
                }

                await AssertQueuesExist(endpointName, errorQueueName, auditQueueName, TimeSpan.FromDays(4), delayedDeliveryMethod : delayedDeliveryMethod)
                .ConfigureAwait(false);
            }
            finally
            {
                await DeleteEndpointQueues.DeleteQueuesForEndpoint(endpointName, delayedDeliveryMethod : delayedDeliveryMethod)
                .ConfigureAwait(false);

                await QueueDeletionUtils.DeleteQueue(errorQueueName)
                .ConfigureAwait(false);

                await QueueDeletionUtils.DeleteQueue(auditQueueName)
                .ConfigureAwait(false);
            }
        }
        public async Task CreateQueuesForEndpointDefaultMaxTTL()
        {
            var endpointName   = "mycreatedefaultendpoint";
            var errorQueueName = "mycreatedefaulterror";
            var auditQueueName = "mycreatedefaultaudit";

            await DeleteEndpointQueues.DeleteQueuesForEndpoint(endpointName)
            .ConfigureAwait(false);

            await QueueDeletionUtils.DeleteQueue(errorQueueName)
            .ConfigureAwait(false);

            await QueueDeletionUtils.DeleteQueue(auditQueueName)
            .ConfigureAwait(false);

            try
            {
                await CreateEndpointQueues.CreateQueuesForEndpoint(endpointName)
                .ConfigureAwait(false);

                await QueueCreationUtils.CreateQueue(
                    queueName : errorQueueName)
                .ConfigureAwait(false);

                await QueueCreationUtils.CreateQueue(
                    queueName : auditQueueName)
                .ConfigureAwait(false);

                await AssertQueuesExist(endpointName, errorQueueName, auditQueueName, TimeSpan.FromDays(4))
                .ConfigureAwait(false);
            }
            finally
            {
                await DeleteEndpointQueues.DeleteQueuesForEndpoint(endpointName)
                .ConfigureAwait(false);

                await QueueDeletionUtils.DeleteQueue(errorQueueName)
                .ConfigureAwait(false);

                await QueueDeletionUtils.DeleteQueue(auditQueueName)
                .ConfigureAwait(false);
            }
        }
Exemple #18
0
        public async Task ReturnMessageToSourceQueue()
        {
            var randomName     = Path.GetFileNameWithoutExtension(Path.GetRandomFileName());
            var endpointName   = $"returnmessagetosourcequeue-{randomName}";
            var errorQueueName = $"returnmessagetosourcequeue-{randomName}-error";

            var state = new State();
            IEndpointInstance endpoint = null;

            try
            {
                endpoint = await StartEndpoint(state, endpointName, errorQueueName).ConfigureAwait(false);

                var messageToSend = new MessageToSend();
                await endpoint.SendLocal(messageToSend).ConfigureAwait(false);

                var messageId = await GetMessageId(errorQueueName).ConfigureAwait(false);

                state.ShouldHandlerThrow = false;

                await ErrorQueue.ReturnMessageToSourceQueue(
                    errorQueueName : errorQueueName,
                    messageId : messageId)
                .ConfigureAwait(false);

                Assert.IsTrue(await state.Signal.Task.ConfigureAwait(false));
            }
            finally
            {
                if (endpoint != null)
                {
                    await endpoint.Stop().ConfigureAwait(false);
                }

                await DeleteEndpointQueues.DeleteQueuesForEndpoint(endpointName, includeRetries : true)
                .ConfigureAwait(false);

                await QueueDeletionUtils.DeleteQueue(errorQueueName)
                .ConfigureAwait(false);
            }
        }
 public void Setup()
 {
     DeleteEndpointQueues.DeleteQueuesForEndpoint(endpointName);
     QueueDeletionUtils.DeleteQueue(errorQueueName);
 }
Exemple #20
0
 public void Setup()
 {
     DeleteEndpointQueues.DeleteQueuesForEndpoint("myendpoint");
     QueueDeletionUtils.DeleteQueue("myerror");
     QueueDeletionUtils.DeleteQueue("myaudit");
 }
Exemple #21
0
 public void Setup()
 {
     DeleteEndpointQueues.DeleteQueuesForEndpoint(QueueNameHelper.GetSqsQueueName(endpointName)).GetAwaiter().GetResult();
     QueueDeletionUtils.DeleteQueue(QueueNameHelper.GetSqsQueueName(errorQueueName)).GetAwaiter().GetResult();
 }