async Task Plugin_with_ShouldContinueOnException_should_continue()
        {
            await ServiceBusScope.UsingQueueAsync(partitioned : false, sessionEnabled : false, async queueName =>
            {
                var messageSender = new MessageSender(TestUtility.NamespaceConnectionString, queueName);
                try
                {
                    var plugin = new ShouldCompleteAnywayExceptionPlugin();

                    messageSender.RegisterPlugin(plugin);

                    var sendMessage = new Message(Encoding.UTF8.GetBytes("Test message"));
                    await messageSender.SendAsync(sendMessage);
                }
                finally
                {
                    await messageSender.CloseAsync();
                }

                var messageReceiver = new MessageReceiver(TestUtility.NamespaceConnectionString, queueName, ReceiveMode.ReceiveAndDelete);
                try
                {
                    await messageReceiver.ReceiveAsync();
                }
                finally
                {
                    await messageReceiver.CloseAsync();
                }
            });
        }
Exemple #2
0
        async Task Plugin_with_ShouldContinueOnException_should_continue()
        {
            var messageSender = new MessageSender(TestUtility.NamespaceConnectionString, TestConstants.NonPartitionedQueueName);

            try
            {
                var plugin = new ShouldCompleteAnywayExceptionPlugin();

                messageSender.RegisterPlugin(plugin);

                var sendMessage = new Message(Encoding.UTF8.GetBytes("Test message"));
                await messageSender.SendAsync(sendMessage);
            }
            finally
            {
                await messageSender.CloseAsync();

                var messageReceiver = new MessageReceiver(TestUtility.NamespaceConnectionString, TestConstants.NonPartitionedQueueName, ReceiveMode.ReceiveAndDelete);
                await messageReceiver.ReceiveAsync();

                await messageReceiver.CloseAsync();
            }
        }