From 7d7b2680aa5e402e4e51a1a3e24714458a099b60 Mon Sep 17 00:00:00 2001 From: Kamil Sobol Date: Mon, 16 Nov 2020 14:32:31 -0800 Subject: [PATCH 01/27] wip --- .../src/InvalidQueueMessageHandler.cs | 32 ++++ .../Azure.Storage.Queues/src/QueueClient.cs | 88 ++++++++-- .../src/QueueClientOptions.cs | 5 + .../src/QueueServiceClient.cs | 8 +- .../tests/QueueClientTests.cs | 53 +++++- .../tests/QueueTestBase.cs | 4 +- ...CanHandleInvalidMessageAndReturnValid.json | 162 ++++++++++++++++++ ...ndleInvalidMessageAndReturnValidAsync.json | 162 ++++++++++++++++++ ...alidQueueMessageIfNoHandlerIsProvided.json | 130 ++++++++++++++ ...ueueMessageIfNoHandlerIsProvidedAsync.json | 130 ++++++++++++++ 10 files changed, 759 insertions(+), 15 deletions(-) create mode 100644 sdk/storage/Azure.Storage.Queues/src/InvalidQueueMessageHandler.cs create mode 100644 sdk/storage/Azure.Storage.Queues/tests/SessionRecords/QueueClientTests/CanHandleInvalidMessageAndReturnValid.json create mode 100644 sdk/storage/Azure.Storage.Queues/tests/SessionRecords/QueueClientTests/CanHandleInvalidMessageAndReturnValidAsync.json create mode 100644 sdk/storage/Azure.Storage.Queues/tests/SessionRecords/QueueClientTests/FailsOnInvalidQueueMessageIfNoHandlerIsProvided.json create mode 100644 sdk/storage/Azure.Storage.Queues/tests/SessionRecords/QueueClientTests/FailsOnInvalidQueueMessageIfNoHandlerIsProvidedAsync.json diff --git a/sdk/storage/Azure.Storage.Queues/src/InvalidQueueMessageHandler.cs b/sdk/storage/Azure.Storage.Queues/src/InvalidQueueMessageHandler.cs new file mode 100644 index 0000000000000..9d7e36ed8d0c6 --- /dev/null +++ b/sdk/storage/Azure.Storage.Queues/src/InvalidQueueMessageHandler.cs @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System.Threading; +using System.Threading.Tasks; + +namespace Azure.Storage.Queues +{ + /// + /// TODO (kasobol-msft) add doc. + /// + public abstract class InvalidQueueMessageHandler + { + /// + /// TODO (kasobol-msft) add doc. + /// + /// + /// + /// + /// + public abstract void OnInvalidMessage(string messageId, string popReceipt, string rawBody, CancellationToken cancellationToken); + + /// + /// TODO (kasobol-msft) add doc. + /// + /// + /// + /// + /// + public abstract Task OnInvalidMessageAsync(string messageId, string popReceipt, string rawBody, CancellationToken cancellationToken); + } +} diff --git a/sdk/storage/Azure.Storage.Queues/src/QueueClient.cs b/sdk/storage/Azure.Storage.Queues/src/QueueClient.cs index 66d229ccf5a8c..b7e7a3a424343 100644 --- a/sdk/storage/Azure.Storage.Queues/src/QueueClient.cs +++ b/sdk/storage/Azure.Storage.Queues/src/QueueClient.cs @@ -126,6 +126,10 @@ public virtual string AccountName internal virtual QueueMessageEncoding MessageEncoding => _messageEncoding; + private InvalidQueueMessageHandler _invalidQueueMessageHandler; + + internal virtual InvalidQueueMessageHandler InvalidQueueMessageHandler => _invalidQueueMessageHandler; + /// /// Gets the name of the queue. /// @@ -216,6 +220,7 @@ public QueueClient(string connectionString, string queueName, QueueClientOptions _clientSideEncryption = QueueClientSideEncryptionOptions.CloneFrom(options._clientSideEncryptionOptions); _storageSharedKeyCredential = conn.Credentials as StorageSharedKeyCredential; _messageEncoding = options.MessageEncoding; + _invalidQueueMessageHandler = options.InvalidQueueMessageHandler; AssertEncodingForEncryption(); } @@ -318,6 +323,7 @@ internal QueueClient( _clientSideEncryption = QueueClientSideEncryptionOptions.CloneFrom(options._clientSideEncryptionOptions); _storageSharedKeyCredential = storageSharedKeyCredential; _messageEncoding = options.MessageEncoding; + _invalidQueueMessageHandler = options.InvalidQueueMessageHandler; AssertEncodingForEncryption(); } @@ -346,13 +352,17 @@ internal QueueClient( /// /// The encoding of the message sent over the wire. /// + /// + /// TODO (kasobol-msft) add doc. + /// internal QueueClient( Uri queueUri, HttpPipeline pipeline, QueueClientOptions.ServiceVersion version, ClientDiagnostics clientDiagnostics, ClientSideEncryptionOptions encryptionOptions, - QueueMessageEncoding messageEncoding) + QueueMessageEncoding messageEncoding, + InvalidQueueMessageHandler invalidQueueMessageHandler) { _uri = queueUri; _messagesUri = queueUri.AppendToPath(Constants.Queue.MessagesUri); @@ -361,6 +371,7 @@ internal QueueClient( _clientDiagnostics = clientDiagnostics; _clientSideEncryption = QueueClientSideEncryptionOptions.CloneFrom(encryptionOptions); _messageEncoding = messageEncoding; + _invalidQueueMessageHandler = invalidQueueMessageHandler; AssertEncodingForEncryption(); } #endregion ctors @@ -1907,8 +1918,11 @@ private async Task> ReceiveMessagesInternal( $"Uri: {MessagesUri}\n" + $"{nameof(maxMessages)}: {maxMessages}\n" + $"{nameof(visibilityTimeout)}: {visibilityTimeout}"); + DiagnosticScope scope = ClientDiagnostics.CreateScope(operationName); try { + scope.Start(); + var response = await QueueRestClient.Messages.DequeueAsync( ClientDiagnostics, Pipeline, @@ -1925,31 +1939,80 @@ private async Task> ReceiveMessagesInternal( if (response.IsUnavailable()) { return response.GetRawResponse().AsNoBodyResponse(); - } - else if (UsingClientSideEncryption) + } else { - return Response.FromValue( - await new QueueClientSideDecryptor(ClientSideEncryption) - .ClientSideDecryptMessagesInternal(response.Value.Select(x => QueueMessage.ToQueueMessage(x, _messageEncoding)).ToArray(), async, cancellationToken).ConfigureAwait(false), - response.GetRawResponse()); - } - else - { - return Response.FromValue(response.Value.Select(x => QueueMessage.ToQueueMessage(x, _messageEncoding)).ToArray(), response.GetRawResponse()); + QueueMessage[] queueMessages; + if (_invalidQueueMessageHandler != null) + { + queueMessages = await ToQueueMessagesWithInvalidMessageHandling(response.Value, async, cancellationToken).ConfigureAwait(false); + } else + { + queueMessages = response.Value.Select(x => QueueMessage.ToQueueMessage(x, _messageEncoding)).ToArray(); + } + + if (UsingClientSideEncryption) + { + return Response.FromValue( + await new QueueClientSideDecryptor(ClientSideEncryption) + .ClientSideDecryptMessagesInternal(queueMessages, async, cancellationToken).ConfigureAwait(false), + response.GetRawResponse()); + } + else + { + return Response.FromValue(queueMessages, response.GetRawResponse()); + } } } catch (Exception ex) { + scope.Failed(ex); Pipeline.LogException(ex); throw; } finally { + scope.Dispose(); Pipeline.LogMethodExit(nameof(QueueClient)); } } } + private async Task ToQueueMessagesWithInvalidMessageHandling( + IEnumerable dequeuedMessageItems, + bool async, + CancellationToken cancellationToken) + { + List queueMessages = new List(); + + foreach (var dequeuedMessageItem in dequeuedMessageItems) + { + try + { + queueMessages.Add(QueueMessage.ToQueueMessage(dequeuedMessageItem, _messageEncoding)); + } + catch (FormatException) + { + if (async) + { + await _invalidQueueMessageHandler.OnInvalidMessageAsync( + dequeuedMessageItem.MessageId, + dequeuedMessageItem.PopReceipt, + dequeuedMessageItem.MessageText, + cancellationToken).ConfigureAwait(false); + } else + { + _invalidQueueMessageHandler.OnInvalidMessage( + dequeuedMessageItem.MessageId, + dequeuedMessageItem.PopReceipt, + dequeuedMessageItem.MessageText, + cancellationToken); + } + } + } + + return queueMessages.ToArray(); + } + #endregion ReceiveMessages #region ReceiveMessage @@ -2724,6 +2787,7 @@ public static QueueClient WithClientSideEncryptionOptions(this QueueClient clien client.Version, client.ClientDiagnostics, clientSideEncryptionOptions, - client.MessageEncoding); + client.MessageEncoding, + client.InvalidQueueMessageHandler); } } diff --git a/sdk/storage/Azure.Storage.Queues/src/QueueClientOptions.cs b/sdk/storage/Azure.Storage.Queues/src/QueueClientOptions.cs index e97fae12d1812..550a315346b07 100644 --- a/sdk/storage/Azure.Storage.Queues/src/QueueClientOptions.cs +++ b/sdk/storage/Azure.Storage.Queues/src/QueueClientOptions.cs @@ -108,6 +108,11 @@ public QueueClientOptions(ServiceVersion version = LatestVersion) /// public QueueMessageEncoding MessageEncoding { get; set; } = QueueMessageEncoding.None; + /// + /// TODO (kasobol-msft) add doc. + /// + public InvalidQueueMessageHandler InvalidQueueMessageHandler { get; set; } + #region Advanced Options internal ClientSideEncryptionOptions _clientSideEncryptionOptions; #endregion diff --git a/sdk/storage/Azure.Storage.Queues/src/QueueServiceClient.cs b/sdk/storage/Azure.Storage.Queues/src/QueueServiceClient.cs index dd3efc0b7c9d5..7438deb24e5b5 100644 --- a/sdk/storage/Azure.Storage.Queues/src/QueueServiceClient.cs +++ b/sdk/storage/Azure.Storage.Queues/src/QueueServiceClient.cs @@ -76,6 +76,10 @@ public class QueueServiceClient internal virtual QueueMessageEncoding MessageEncoding => _messageEncoding; + private readonly InvalidQueueMessageHandler _invalidQueueMessageHandler; + + internal virtual InvalidQueueMessageHandler InvalidQueueMessageHandler => _invalidQueueMessageHandler; + /// /// The Storage account name corresponding to the service client. /// @@ -163,6 +167,7 @@ public QueueServiceClient(string connectionString, QueueClientOptions options) _clientSideEncryption = QueueClientSideEncryptionOptions.CloneFrom(options._clientSideEncryptionOptions); _storageSharedKeyCredential = conn.Credentials as StorageSharedKeyCredential; _messageEncoding = options.MessageEncoding; + _invalidQueueMessageHandler = options.InvalidQueueMessageHandler; } /// @@ -259,6 +264,7 @@ internal QueueServiceClient( _clientSideEncryption = QueueClientSideEncryptionOptions.CloneFrom(options._clientSideEncryptionOptions); _storageSharedKeyCredential = storageSharedKeyCredential; _messageEncoding = options.MessageEncoding; + _invalidQueueMessageHandler = options.InvalidQueueMessageHandler; } #endregion ctors @@ -275,7 +281,7 @@ internal QueueServiceClient( /// A for the desired queue. /// public virtual QueueClient GetQueueClient(string queueName) - => new QueueClient(Uri.AppendToPath(queueName), Pipeline, Version, ClientDiagnostics, ClientSideEncryption, MessageEncoding); + => new QueueClient(Uri.AppendToPath(queueName), Pipeline, Version, ClientDiagnostics, ClientSideEncryption, MessageEncoding, InvalidQueueMessageHandler); #region GetQueues /// diff --git a/sdk/storage/Azure.Storage.Queues/tests/QueueClientTests.cs b/sdk/storage/Azure.Storage.Queues/tests/QueueClientTests.cs index 63a98f23ac0e0..e9808803ee960 100644 --- a/sdk/storage/Azure.Storage.Queues/tests/QueueClientTests.cs +++ b/sdk/storage/Azure.Storage.Queues/tests/QueueClientTests.cs @@ -14,13 +14,16 @@ using Azure.Core.TestFramework; using System.Buffers.Text; using System.Text; +using Moq; +using System.Threading; +using System.Runtime.InteropServices; namespace Azure.Storage.Queues.Test { public class QueueClientTests : QueueTestBase { public QueueClientTests(bool async) - : base(async, null /* RecordedTestMode.Record /* to re-record */) + : base(async, RecordedTestMode.Record /* RecordedTestMode.Record /* to re-record */) { } @@ -776,6 +779,54 @@ public async Task CanSendAndReceiveNonUTFBytes() CollectionAssert.AreEqual(content, receivedMessage.Body.ToArray()); } + [Test] + public async Task FailsOnInvalidQueueMessageIfNoHandlerIsProvided() + { + // Arrange + await using DisposingQueue test = await GetTestQueueAsync(); + var encodingClient = GetEncodingClient(test.Queue.Name, QueueMessageEncoding.Base64); + var nonEncodedContent = "test_content"; + + await test.Queue.SendMessageAsync(nonEncodedContent); + + // Act + await TestHelper.AssertExpectedExceptionAsync( + encodingClient.ReceiveMessagesAsync(), + e => + { + StringAssert.Contains("The input is not a valid Base-64 string", e.Message); + }); + } + + [Test] + public async Task CanHandleInvalidMessageAndReturnValid() + { + // Arrange + Mock invalidQueueMessageHandlerMock = new Mock(); + await using DisposingQueue test = await GetTestQueueAsync(); + var encodingClient = GetEncodingClient(test.Queue.Name, QueueMessageEncoding.Base64, invalidQueueMessageHandlerMock.Object); + var nonEncodedContent = "test_content"; + + await test.Queue.SendMessageAsync(nonEncodedContent); + await encodingClient.SendMessageAsync(nonEncodedContent); + + // Act + QueueMessage[] queueMessages = await encodingClient.ReceiveMessagesAsync(10); + + // Assert + Assert.AreEqual(1, queueMessages.Count()); + if (IsAsync) + { + invalidQueueMessageHandlerMock.Verify( + m => m.OnInvalidMessageAsync(It.IsAny(), It.IsAny(), nonEncodedContent, It.IsAny())); + } + else + { + invalidQueueMessageHandlerMock.Verify( + m => m.OnInvalidMessage(It.IsAny(), It.IsAny(), nonEncodedContent, It.IsAny())); + } + } + [Test] public async Task SendMessageAsync_SAS() { diff --git a/sdk/storage/Azure.Storage.Queues/tests/QueueTestBase.cs b/sdk/storage/Azure.Storage.Queues/tests/QueueTestBase.cs index 4571890deda94..01f82842bb265 100644 --- a/sdk/storage/Azure.Storage.Queues/tests/QueueTestBase.cs +++ b/sdk/storage/Azure.Storage.Queues/tests/QueueTestBase.cs @@ -153,10 +153,12 @@ public async Task GetTestQueueAsync( public QueueClient GetEncodingClient( string queueName, - QueueMessageEncoding encoding) + QueueMessageEncoding encoding, + InvalidQueueMessageHandler invalidQueueMessageHandler = default) { var options = GetOptions(); options.MessageEncoding = encoding; + options.InvalidQueueMessageHandler = invalidQueueMessageHandler; var service = GetServiceClient_SharedKey(options); return InstrumentClient(service.GetQueueClient(queueName)); } diff --git a/sdk/storage/Azure.Storage.Queues/tests/SessionRecords/QueueClientTests/CanHandleInvalidMessageAndReturnValid.json b/sdk/storage/Azure.Storage.Queues/tests/SessionRecords/QueueClientTests/CanHandleInvalidMessageAndReturnValid.json new file mode 100644 index 0000000000000..9a32985b6d975 --- /dev/null +++ b/sdk/storage/Azure.Storage.Queues/tests/SessionRecords/QueueClientTests/CanHandleInvalidMessageAndReturnValid.json @@ -0,0 +1,162 @@ +{ + "Entries": [ + { + "RequestUri": "http://kasoboltest.queue.core.windows.net/test-queue-d7128aab-de8f-566b-a7c9-68026a4e2ed9", + "RequestMethod": "PUT", + "RequestHeaders": { + "Authorization": "Sanitized", + "traceparent": "00-df0ca682fc8a1846ae25b7a3dca9cc93-11e094a071ab5f45-00", + "User-Agent": [ + "azsdk-net-Storage.Queues/12.6.0-alpha.20201116.1", + "(.NET Core 4.6.29321.03; Microsoft Windows 10.0.19042 )" + ], + "x-ms-client-request-id": "5d1d7b1f-3964-d68f-d16e-1d5964704bf2", + "x-ms-date": "Mon, 16 Nov 2020 22:31:45 GMT", + "x-ms-return-client-request-id": "true", + "x-ms-version": "2018-11-09" + }, + "RequestBody": null, + "StatusCode": 201, + "ResponseHeaders": { + "Content-Length": "0", + "Date": "Mon, 16 Nov 2020 22:31:46 GMT", + "Server": [ + "Windows-Azure-Queue/1.0", + "Microsoft-HTTPAPI/2.0" + ], + "x-ms-request-id": "2e014042-9003-002f-4268-bcd5c9000000", + "x-ms-version": "2018-11-09" + }, + "ResponseBody": [] + }, + { + "RequestUri": "http://kasoboltest.queue.core.windows.net/test-queue-d7128aab-de8f-566b-a7c9-68026a4e2ed9/messages", + "RequestMethod": "POST", + "RequestHeaders": { + "Authorization": "Sanitized", + "Content-Length": "68", + "Content-Type": "application/xml", + "traceparent": "00-a8c305b3bb97704089b047c3204af20f-79f2ec1f24d7c347-00", + "User-Agent": [ + "azsdk-net-Storage.Queues/12.6.0-alpha.20201116.1", + "(.NET Core 4.6.29321.03; Microsoft Windows 10.0.19042 )" + ], + "x-ms-client-request-id": "eee34d93-d130-d074-14b5-10b861cf877c", + "x-ms-date": "Mon, 16 Nov 2020 22:31:46 GMT", + "x-ms-return-client-request-id": "true", + "x-ms-version": "2018-11-09" + }, + "RequestBody": "\u003CQueueMessage\u003E\u003CMessageText\u003Etest_content\u003C/MessageText\u003E\u003C/QueueMessage\u003E", + "StatusCode": 201, + "ResponseHeaders": { + "Content-Type": "application/xml", + "Date": "Mon, 16 Nov 2020 22:31:46 GMT", + "Server": [ + "Windows-Azure-Queue/1.0", + "Microsoft-HTTPAPI/2.0" + ], + "Transfer-Encoding": "chunked", + "x-ms-request-id": "2e01404b-9003-002f-4968-bcd5c9000000", + "x-ms-version": "2018-11-09" + }, + "ResponseBody": "\uFEFF\u003C?xml version=\u00221.0\u0022 encoding=\u0022utf-8\u0022?\u003E\u003CQueueMessagesList\u003E\u003CQueueMessage\u003E\u003CMessageId\u003Eeb8f3c02-bbbf-4cf9-af60-c8bf8395df33\u003C/MessageId\u003E\u003CInsertionTime\u003EMon, 16 Nov 2020 22:31:46 GMT\u003C/InsertionTime\u003E\u003CExpirationTime\u003EMon, 23 Nov 2020 22:31:46 GMT\u003C/ExpirationTime\u003E\u003CPopReceipt\u003EAgAAAAMAAAAAAAAA2043RGi81gE=\u003C/PopReceipt\u003E\u003CTimeNextVisible\u003EMon, 16 Nov 2020 22:31:46 GMT\u003C/TimeNextVisible\u003E\u003C/QueueMessage\u003E\u003C/QueueMessagesList\u003E" + }, + { + "RequestUri": "http://kasoboltest.queue.core.windows.net/test-queue-d7128aab-de8f-566b-a7c9-68026a4e2ed9/messages", + "RequestMethod": "POST", + "RequestHeaders": { + "Authorization": "Sanitized", + "Content-Length": "72", + "Content-Type": "application/xml", + "traceparent": "00-cae920b501c41f4ba0d09b3535467cc8-86d82b24dea2bd4e-00", + "User-Agent": [ + "azsdk-net-Storage.Queues/12.6.0-alpha.20201116.1", + "(.NET Core 4.6.29321.03; Microsoft Windows 10.0.19042 )" + ], + "x-ms-client-request-id": "17c5ae04-5d8d-2ec2-b7bb-9c5ea7ffcb91", + "x-ms-date": "Mon, 16 Nov 2020 22:31:46 GMT", + "x-ms-return-client-request-id": "true", + "x-ms-version": "2018-11-09" + }, + "RequestBody": "\u003CQueueMessage\u003E\u003CMessageText\u003EdGVzdF9jb250ZW50\u003C/MessageText\u003E\u003C/QueueMessage\u003E", + "StatusCode": 201, + "ResponseHeaders": { + "Content-Type": "application/xml", + "Date": "Mon, 16 Nov 2020 22:31:45 GMT", + "Server": [ + "Windows-Azure-Queue/1.0", + "Microsoft-HTTPAPI/2.0" + ], + "Transfer-Encoding": "chunked", + "x-ms-request-id": "ca363b92-a003-0005-3868-bca08c000000", + "x-ms-version": "2018-11-09" + }, + "ResponseBody": "\uFEFF\u003C?xml version=\u00221.0\u0022 encoding=\u0022utf-8\u0022?\u003E\u003CQueueMessagesList\u003E\u003CQueueMessage\u003E\u003CMessageId\u003E8ffbc868-61ff-44c4-b32c-cafc7b6ac992\u003C/MessageId\u003E\u003CInsertionTime\u003EMon, 16 Nov 2020 22:31:46 GMT\u003C/InsertionTime\u003E\u003CExpirationTime\u003EMon, 23 Nov 2020 22:31:46 GMT\u003C/ExpirationTime\u003E\u003CPopReceipt\u003EAgAAAAMAAAAAAAAAqhRBRGi81gE=\u003C/PopReceipt\u003E\u003CTimeNextVisible\u003EMon, 16 Nov 2020 22:31:46 GMT\u003C/TimeNextVisible\u003E\u003C/QueueMessage\u003E\u003C/QueueMessagesList\u003E" + }, + { + "RequestUri": "http://kasoboltest.queue.core.windows.net/test-queue-d7128aab-de8f-566b-a7c9-68026a4e2ed9/messages?numofmessages=10", + "RequestMethod": "GET", + "RequestHeaders": { + "Authorization": "Sanitized", + "traceparent": "00-0adec9dc58f05047860cbefd0f3504db-92d642e5dbd9f049-00", + "User-Agent": [ + "azsdk-net-Storage.Queues/12.6.0-alpha.20201116.1", + "(.NET Core 4.6.29321.03; Microsoft Windows 10.0.19042 )" + ], + "x-ms-client-request-id": "b2b31eac-7009-4aef-5b5e-08f1e7a9bec3", + "x-ms-date": "Mon, 16 Nov 2020 22:31:46 GMT", + "x-ms-return-client-request-id": "true", + "x-ms-version": "2018-11-09" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "Cache-Control": "no-cache", + "Content-Type": "application/xml", + "Date": "Mon, 16 Nov 2020 22:31:45 GMT", + "Server": [ + "Windows-Azure-Queue/1.0", + "Microsoft-HTTPAPI/2.0" + ], + "Transfer-Encoding": "chunked", + "Vary": "Origin", + "x-ms-request-id": "ca363b99-a003-0005-3d68-bca08c000000", + "x-ms-version": "2018-11-09" + }, + "ResponseBody": "\uFEFF\u003C?xml version=\u00221.0\u0022 encoding=\u0022utf-8\u0022?\u003E\u003CQueueMessagesList\u003E\u003CQueueMessage\u003E\u003CMessageId\u003Eeb8f3c02-bbbf-4cf9-af60-c8bf8395df33\u003C/MessageId\u003E\u003CInsertionTime\u003EMon, 16 Nov 2020 22:31:46 GMT\u003C/InsertionTime\u003E\u003CExpirationTime\u003EMon, 23 Nov 2020 22:31:46 GMT\u003C/ExpirationTime\u003E\u003CPopReceipt\u003EAgAAAAMAAAAAAAAAYKgqVmi81gE=\u003C/PopReceipt\u003E\u003CTimeNextVisible\u003EMon, 16 Nov 2020 22:32:16 GMT\u003C/TimeNextVisible\u003E\u003CDequeueCount\u003E1\u003C/DequeueCount\u003E\u003CMessageText\u003Etest_content\u003C/MessageText\u003E\u003C/QueueMessage\u003E\u003CQueueMessage\u003E\u003CMessageId\u003E8ffbc868-61ff-44c4-b32c-cafc7b6ac992\u003C/MessageId\u003E\u003CInsertionTime\u003EMon, 16 Nov 2020 22:31:46 GMT\u003C/InsertionTime\u003E\u003CExpirationTime\u003EMon, 23 Nov 2020 22:31:46 GMT\u003C/ExpirationTime\u003E\u003CPopReceipt\u003EAgAAAAMAAAAAAAAAYKgqVmi81gE=\u003C/PopReceipt\u003E\u003CTimeNextVisible\u003EMon, 16 Nov 2020 22:32:16 GMT\u003C/TimeNextVisible\u003E\u003CDequeueCount\u003E1\u003C/DequeueCount\u003E\u003CMessageText\u003EdGVzdF9jb250ZW50\u003C/MessageText\u003E\u003C/QueueMessage\u003E\u003C/QueueMessagesList\u003E" + }, + { + "RequestUri": "http://kasoboltest.queue.core.windows.net/test-queue-d7128aab-de8f-566b-a7c9-68026a4e2ed9", + "RequestMethod": "DELETE", + "RequestHeaders": { + "Authorization": "Sanitized", + "traceparent": "00-51aee3e259bc9245b4c5fa62f9f6a555-0df9fdbc8de8794c-00", + "User-Agent": [ + "azsdk-net-Storage.Queues/12.6.0-alpha.20201116.1", + "(.NET Core 4.6.29321.03; Microsoft Windows 10.0.19042 )" + ], + "x-ms-client-request-id": "89b17b3a-194b-2e87-7da9-54f3a0cf289c", + "x-ms-date": "Mon, 16 Nov 2020 22:31:46 GMT", + "x-ms-return-client-request-id": "true", + "x-ms-version": "2018-11-09" + }, + "RequestBody": null, + "StatusCode": 204, + "ResponseHeaders": { + "Content-Length": "0", + "Date": "Mon, 16 Nov 2020 22:31:46 GMT", + "Server": [ + "Windows-Azure-Queue/1.0", + "Microsoft-HTTPAPI/2.0" + ], + "x-ms-request-id": "2e014057-9003-002f-5468-bcd5c9000000", + "x-ms-version": "2018-11-09" + }, + "ResponseBody": [] + } + ], + "Variables": { + "RandomSeed": "1486437419", + "Storage_TestConfigDefault": "ProductionTenant\nkasoboltest\nU2FuaXRpemVk\nhttp://kasoboltest.blob.core.windows.net\nhttp://kasoboltest.file.core.windows.net\nhttp://kasoboltest.queue.core.windows.net\nhttp://kasoboltest.table.core.windows.net\n\n\n\n\nhttp://kasoboltest-secondary.blob.core.windows.net\nhttp://kasoboltest-secondary.file.core.windows.net\nhttp://kasoboltest-secondary.queue.core.windows.net\nhttp://kasoboltest-secondary.table.core.windows.net\n\nSanitized\n\n\nCloud\nBlobEndpoint=http://kasoboltest.blob.core.windows.net/;QueueEndpoint=http://kasoboltest.queue.core.windows.net/;FileEndpoint=http://kasoboltest.file.core.windows.net/;BlobSecondaryEndpoint=http://kasoboltest-secondary.blob.core.windows.net/;QueueSecondaryEndpoint=http://kasoboltest-secondary.queue.core.windows.net/;FileSecondaryEndpoint=http://kasoboltest-secondary.file.core.windows.net/;AccountName=kasoboltest;AccountKey=Kg==;\nencryptionScope" + } +} \ No newline at end of file diff --git a/sdk/storage/Azure.Storage.Queues/tests/SessionRecords/QueueClientTests/CanHandleInvalidMessageAndReturnValidAsync.json b/sdk/storage/Azure.Storage.Queues/tests/SessionRecords/QueueClientTests/CanHandleInvalidMessageAndReturnValidAsync.json new file mode 100644 index 0000000000000..79b03e5529269 --- /dev/null +++ b/sdk/storage/Azure.Storage.Queues/tests/SessionRecords/QueueClientTests/CanHandleInvalidMessageAndReturnValidAsync.json @@ -0,0 +1,162 @@ +{ + "Entries": [ + { + "RequestUri": "http://kasoboltest.queue.core.windows.net/test-queue-c5683fc2-f70b-440a-29ee-3d7d009be19e", + "RequestMethod": "PUT", + "RequestHeaders": { + "Authorization": "Sanitized", + "traceparent": "00-74025cf8d478f14bad74c29f231882a1-fcd6bf17c74b8d41-00", + "User-Agent": [ + "azsdk-net-Storage.Queues/12.6.0-alpha.20201116.1", + "(.NET Core 4.6.29321.03; Microsoft Windows 10.0.19042 )" + ], + "x-ms-client-request-id": "14f54917-8966-c9a4-4e04-df6c43ff8841", + "x-ms-date": "Mon, 16 Nov 2020 22:31:46 GMT", + "x-ms-return-client-request-id": "true", + "x-ms-version": "2018-11-09" + }, + "RequestBody": null, + "StatusCode": 201, + "ResponseHeaders": { + "Content-Length": "0", + "Date": "Mon, 16 Nov 2020 22:31:45 GMT", + "Server": [ + "Windows-Azure-Queue/1.0", + "Microsoft-HTTPAPI/2.0" + ], + "x-ms-request-id": "d73ce5be-f003-003f-6d68-bce32f000000", + "x-ms-version": "2018-11-09" + }, + "ResponseBody": [] + }, + { + "RequestUri": "http://kasoboltest.queue.core.windows.net/test-queue-c5683fc2-f70b-440a-29ee-3d7d009be19e/messages", + "RequestMethod": "POST", + "RequestHeaders": { + "Authorization": "Sanitized", + "Content-Length": "68", + "Content-Type": "application/xml", + "traceparent": "00-05ad8e8c7496a74cbaf46f5b1777e86c-deca65c6bad4fd4b-00", + "User-Agent": [ + "azsdk-net-Storage.Queues/12.6.0-alpha.20201116.1", + "(.NET Core 4.6.29321.03; Microsoft Windows 10.0.19042 )" + ], + "x-ms-client-request-id": "b6654d0f-cda5-1137-5552-8b4e87cf9472", + "x-ms-date": "Mon, 16 Nov 2020 22:31:46 GMT", + "x-ms-return-client-request-id": "true", + "x-ms-version": "2018-11-09" + }, + "RequestBody": "\u003CQueueMessage\u003E\u003CMessageText\u003Etest_content\u003C/MessageText\u003E\u003C/QueueMessage\u003E", + "StatusCode": 201, + "ResponseHeaders": { + "Content-Type": "application/xml", + "Date": "Mon, 16 Nov 2020 22:31:46 GMT", + "Server": [ + "Windows-Azure-Queue/1.0", + "Microsoft-HTTPAPI/2.0" + ], + "Transfer-Encoding": "chunked", + "x-ms-request-id": "d73ce5d2-f003-003f-7d68-bce32f000000", + "x-ms-version": "2018-11-09" + }, + "ResponseBody": "\uFEFF\u003C?xml version=\u00221.0\u0022 encoding=\u0022utf-8\u0022?\u003E\u003CQueueMessagesList\u003E\u003CQueueMessage\u003E\u003CMessageId\u003E356508b7-170f-439c-afc3-0f519046f5e1\u003C/MessageId\u003E\u003CInsertionTime\u003EMon, 16 Nov 2020 22:31:46 GMT\u003C/InsertionTime\u003E\u003CExpirationTime\u003EMon, 23 Nov 2020 22:31:46 GMT\u003C/ExpirationTime\u003E\u003CPopReceipt\u003EAgAAAAMAAAAAAAAAsiJ3RGi81gE=\u003C/PopReceipt\u003E\u003CTimeNextVisible\u003EMon, 16 Nov 2020 22:31:46 GMT\u003C/TimeNextVisible\u003E\u003C/QueueMessage\u003E\u003C/QueueMessagesList\u003E" + }, + { + "RequestUri": "http://kasoboltest.queue.core.windows.net/test-queue-c5683fc2-f70b-440a-29ee-3d7d009be19e/messages", + "RequestMethod": "POST", + "RequestHeaders": { + "Authorization": "Sanitized", + "Content-Length": "72", + "Content-Type": "application/xml", + "traceparent": "00-865516e1d4976646877b12ff7821955e-4be903b6d9336746-00", + "User-Agent": [ + "azsdk-net-Storage.Queues/12.6.0-alpha.20201116.1", + "(.NET Core 4.6.29321.03; Microsoft Windows 10.0.19042 )" + ], + "x-ms-client-request-id": "f65ddba6-d199-889b-15db-8ae85a70d434", + "x-ms-date": "Mon, 16 Nov 2020 22:31:46 GMT", + "x-ms-return-client-request-id": "true", + "x-ms-version": "2018-11-09" + }, + "RequestBody": "\u003CQueueMessage\u003E\u003CMessageText\u003EdGVzdF9jb250ZW50\u003C/MessageText\u003E\u003C/QueueMessage\u003E", + "StatusCode": 201, + "ResponseHeaders": { + "Content-Type": "application/xml", + "Date": "Mon, 16 Nov 2020 22:31:46 GMT", + "Server": [ + "Windows-Azure-Queue/1.0", + "Microsoft-HTTPAPI/2.0" + ], + "Transfer-Encoding": "chunked", + "x-ms-request-id": "4b3ecf2f-d003-0028-0268-bc234c000000", + "x-ms-version": "2018-11-09" + }, + "ResponseBody": "\uFEFF\u003C?xml version=\u00221.0\u0022 encoding=\u0022utf-8\u0022?\u003E\u003CQueueMessagesList\u003E\u003CQueueMessage\u003E\u003CMessageId\u003E47a03680-9c1e-47df-ade5-9de544de6ee7\u003C/MessageId\u003E\u003CInsertionTime\u003EMon, 16 Nov 2020 22:31:46 GMT\u003C/InsertionTime\u003E\u003CExpirationTime\u003EMon, 23 Nov 2020 22:31:46 GMT\u003C/ExpirationTime\u003E\u003CPopReceipt\u003EAgAAAAMAAAAAAAAAlw\u002BBRGi81gE=\u003C/PopReceipt\u003E\u003CTimeNextVisible\u003EMon, 16 Nov 2020 22:31:46 GMT\u003C/TimeNextVisible\u003E\u003C/QueueMessage\u003E\u003C/QueueMessagesList\u003E" + }, + { + "RequestUri": "http://kasoboltest.queue.core.windows.net/test-queue-c5683fc2-f70b-440a-29ee-3d7d009be19e/messages?numofmessages=10", + "RequestMethod": "GET", + "RequestHeaders": { + "Authorization": "Sanitized", + "traceparent": "00-f748a100c83bba428a683967eca7d8ef-fc348addb4ebda46-00", + "User-Agent": [ + "azsdk-net-Storage.Queues/12.6.0-alpha.20201116.1", + "(.NET Core 4.6.29321.03; Microsoft Windows 10.0.19042 )" + ], + "x-ms-client-request-id": "aba85dbf-9d71-ffd9-e40c-845d75cdd81a", + "x-ms-date": "Mon, 16 Nov 2020 22:31:46 GMT", + "x-ms-return-client-request-id": "true", + "x-ms-version": "2018-11-09" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "Cache-Control": "no-cache", + "Content-Type": "application/xml", + "Date": "Mon, 16 Nov 2020 22:31:46 GMT", + "Server": [ + "Windows-Azure-Queue/1.0", + "Microsoft-HTTPAPI/2.0" + ], + "Transfer-Encoding": "chunked", + "Vary": "Origin", + "x-ms-request-id": "4b3ecf43-d003-0028-1468-bc234c000000", + "x-ms-version": "2018-11-09" + }, + "ResponseBody": "\uFEFF\u003C?xml version=\u00221.0\u0022 encoding=\u0022utf-8\u0022?\u003E\u003CQueueMessagesList\u003E\u003CQueueMessage\u003E\u003CMessageId\u003E356508b7-170f-439c-afc3-0f519046f5e1\u003C/MessageId\u003E\u003CInsertionTime\u003EMon, 16 Nov 2020 22:31:46 GMT\u003C/InsertionTime\u003E\u003CExpirationTime\u003EMon, 23 Nov 2020 22:31:46 GMT\u003C/ExpirationTime\u003E\u003CPopReceipt\u003EAgAAAAMAAAAAAAAAeJVnVmi81gE=\u003C/PopReceipt\u003E\u003CTimeNextVisible\u003EMon, 16 Nov 2020 22:32:16 GMT\u003C/TimeNextVisible\u003E\u003CDequeueCount\u003E1\u003C/DequeueCount\u003E\u003CMessageText\u003Etest_content\u003C/MessageText\u003E\u003C/QueueMessage\u003E\u003CQueueMessage\u003E\u003CMessageId\u003E47a03680-9c1e-47df-ade5-9de544de6ee7\u003C/MessageId\u003E\u003CInsertionTime\u003EMon, 16 Nov 2020 22:31:46 GMT\u003C/InsertionTime\u003E\u003CExpirationTime\u003EMon, 23 Nov 2020 22:31:46 GMT\u003C/ExpirationTime\u003E\u003CPopReceipt\u003EAgAAAAMAAAAAAAAAeJVnVmi81gE=\u003C/PopReceipt\u003E\u003CTimeNextVisible\u003EMon, 16 Nov 2020 22:32:16 GMT\u003C/TimeNextVisible\u003E\u003CDequeueCount\u003E1\u003C/DequeueCount\u003E\u003CMessageText\u003EdGVzdF9jb250ZW50\u003C/MessageText\u003E\u003C/QueueMessage\u003E\u003C/QueueMessagesList\u003E" + }, + { + "RequestUri": "http://kasoboltest.queue.core.windows.net/test-queue-c5683fc2-f70b-440a-29ee-3d7d009be19e", + "RequestMethod": "DELETE", + "RequestHeaders": { + "Authorization": "Sanitized", + "traceparent": "00-5ce75916f0c58c4a82aa499a361e8f69-3946eb722cdb5046-00", + "User-Agent": [ + "azsdk-net-Storage.Queues/12.6.0-alpha.20201116.1", + "(.NET Core 4.6.29321.03; Microsoft Windows 10.0.19042 )" + ], + "x-ms-client-request-id": "fc282600-28c7-5ec2-07e3-d180406d9aca", + "x-ms-date": "Mon, 16 Nov 2020 22:31:46 GMT", + "x-ms-return-client-request-id": "true", + "x-ms-version": "2018-11-09" + }, + "RequestBody": null, + "StatusCode": 204, + "ResponseHeaders": { + "Content-Length": "0", + "Date": "Mon, 16 Nov 2020 22:31:46 GMT", + "Server": [ + "Windows-Azure-Queue/1.0", + "Microsoft-HTTPAPI/2.0" + ], + "x-ms-request-id": "d73ce5e5-f003-003f-0e68-bce32f000000", + "x-ms-version": "2018-11-09" + }, + "ResponseBody": [] + } + ], + "Variables": { + "RandomSeed": "1418509458", + "Storage_TestConfigDefault": "ProductionTenant\nkasoboltest\nU2FuaXRpemVk\nhttp://kasoboltest.blob.core.windows.net\nhttp://kasoboltest.file.core.windows.net\nhttp://kasoboltest.queue.core.windows.net\nhttp://kasoboltest.table.core.windows.net\n\n\n\n\nhttp://kasoboltest-secondary.blob.core.windows.net\nhttp://kasoboltest-secondary.file.core.windows.net\nhttp://kasoboltest-secondary.queue.core.windows.net\nhttp://kasoboltest-secondary.table.core.windows.net\n\nSanitized\n\n\nCloud\nBlobEndpoint=http://kasoboltest.blob.core.windows.net/;QueueEndpoint=http://kasoboltest.queue.core.windows.net/;FileEndpoint=http://kasoboltest.file.core.windows.net/;BlobSecondaryEndpoint=http://kasoboltest-secondary.blob.core.windows.net/;QueueSecondaryEndpoint=http://kasoboltest-secondary.queue.core.windows.net/;FileSecondaryEndpoint=http://kasoboltest-secondary.file.core.windows.net/;AccountName=kasoboltest;AccountKey=Kg==;\nencryptionScope" + } +} \ No newline at end of file diff --git a/sdk/storage/Azure.Storage.Queues/tests/SessionRecords/QueueClientTests/FailsOnInvalidQueueMessageIfNoHandlerIsProvided.json b/sdk/storage/Azure.Storage.Queues/tests/SessionRecords/QueueClientTests/FailsOnInvalidQueueMessageIfNoHandlerIsProvided.json new file mode 100644 index 0000000000000..4ee0a07232215 --- /dev/null +++ b/sdk/storage/Azure.Storage.Queues/tests/SessionRecords/QueueClientTests/FailsOnInvalidQueueMessageIfNoHandlerIsProvided.json @@ -0,0 +1,130 @@ +{ + "Entries": [ + { + "RequestUri": "http://kasoboltest.queue.core.windows.net/test-queue-186b9a2d-2db9-6a0b-f23c-b2fe3ac42f03", + "RequestMethod": "PUT", + "RequestHeaders": { + "Authorization": "Sanitized", + "traceparent": "00-0367c5b549e5a54a851143eaf232e072-b5187cee6e459c4d-00", + "User-Agent": [ + "azsdk-net-Storage.Queues/12.6.0-alpha.20201116.1", + "(.NET Core 4.6.29321.03; Microsoft Windows 10.0.19042 )" + ], + "x-ms-client-request-id": "737c90b1-5f3a-7018-428b-4360f1578525", + "x-ms-date": "Mon, 16 Nov 2020 22:31:54 GMT", + "x-ms-return-client-request-id": "true", + "x-ms-version": "2018-11-09" + }, + "RequestBody": null, + "StatusCode": 201, + "ResponseHeaders": { + "Content-Length": "0", + "Date": "Mon, 16 Nov 2020 22:31:54 GMT", + "Server": [ + "Windows-Azure-Queue/1.0", + "Microsoft-HTTPAPI/2.0" + ], + "x-ms-request-id": "1b4f3064-2003-005b-5c68-bc538f000000", + "x-ms-version": "2018-11-09" + }, + "ResponseBody": [] + }, + { + "RequestUri": "http://kasoboltest.queue.core.windows.net/test-queue-186b9a2d-2db9-6a0b-f23c-b2fe3ac42f03/messages", + "RequestMethod": "POST", + "RequestHeaders": { + "Authorization": "Sanitized", + "Content-Length": "68", + "Content-Type": "application/xml", + "traceparent": "00-a15446e5c6683d40852ebb55acb98933-61dec84972c4e640-00", + "User-Agent": [ + "azsdk-net-Storage.Queues/12.6.0-alpha.20201116.1", + "(.NET Core 4.6.29321.03; Microsoft Windows 10.0.19042 )" + ], + "x-ms-client-request-id": "aa4d86ec-bb48-d2c8-5205-6763686dce10", + "x-ms-date": "Mon, 16 Nov 2020 22:31:54 GMT", + "x-ms-return-client-request-id": "true", + "x-ms-version": "2018-11-09" + }, + "RequestBody": "\u003CQueueMessage\u003E\u003CMessageText\u003Etest_content\u003C/MessageText\u003E\u003C/QueueMessage\u003E", + "StatusCode": 201, + "ResponseHeaders": { + "Content-Type": "application/xml", + "Date": "Mon, 16 Nov 2020 22:31:54 GMT", + "Server": [ + "Windows-Azure-Queue/1.0", + "Microsoft-HTTPAPI/2.0" + ], + "Transfer-Encoding": "chunked", + "x-ms-request-id": "1b4f306f-2003-005b-6468-bc538f000000", + "x-ms-version": "2018-11-09" + }, + "ResponseBody": "\uFEFF\u003C?xml version=\u00221.0\u0022 encoding=\u0022utf-8\u0022?\u003E\u003CQueueMessagesList\u003E\u003CQueueMessage\u003E\u003CMessageId\u003Ea9c7ad5f-62e8-4b4e-880c-4ae7d82e537d\u003C/MessageId\u003E\u003CInsertionTime\u003EMon, 16 Nov 2020 22:31:54 GMT\u003C/InsertionTime\u003E\u003CExpirationTime\u003EMon, 23 Nov 2020 22:31:54 GMT\u003C/ExpirationTime\u003E\u003CPopReceipt\u003EAgAAAAMAAAAAAAAAgB9OSWi81gE=\u003C/PopReceipt\u003E\u003CTimeNextVisible\u003EMon, 16 Nov 2020 22:31:54 GMT\u003C/TimeNextVisible\u003E\u003C/QueueMessage\u003E\u003C/QueueMessagesList\u003E" + }, + { + "RequestUri": "http://kasoboltest.queue.core.windows.net/test-queue-186b9a2d-2db9-6a0b-f23c-b2fe3ac42f03/messages", + "RequestMethod": "GET", + "RequestHeaders": { + "Authorization": "Sanitized", + "traceparent": "00-4e31eda8ed12594783c37a0f54fe95a9-3961ccd47a928f4b-00", + "User-Agent": [ + "azsdk-net-Storage.Queues/12.6.0-alpha.20201116.1", + "(.NET Core 4.6.29321.03; Microsoft Windows 10.0.19042 )" + ], + "x-ms-client-request-id": "6a747034-db09-41dc-fa2b-a4071a3d185f", + "x-ms-date": "Mon, 16 Nov 2020 22:31:54 GMT", + "x-ms-return-client-request-id": "true", + "x-ms-version": "2018-11-09" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "Cache-Control": "no-cache", + "Content-Type": "application/xml", + "Date": "Mon, 16 Nov 2020 22:31:54 GMT", + "Server": [ + "Windows-Azure-Queue/1.0", + "Microsoft-HTTPAPI/2.0" + ], + "Transfer-Encoding": "chunked", + "Vary": "Origin", + "x-ms-request-id": "8b3f4c2b-1003-001c-1f68-bc8ce4000000", + "x-ms-version": "2018-11-09" + }, + "ResponseBody": "\uFEFF\u003C?xml version=\u00221.0\u0022 encoding=\u0022utf-8\u0022?\u003E\u003CQueueMessagesList\u003E\u003CQueueMessage\u003E\u003CMessageId\u003Ea9c7ad5f-62e8-4b4e-880c-4ae7d82e537d\u003C/MessageId\u003E\u003CInsertionTime\u003EMon, 16 Nov 2020 22:31:54 GMT\u003C/InsertionTime\u003E\u003CExpirationTime\u003EMon, 23 Nov 2020 22:31:54 GMT\u003C/ExpirationTime\u003E\u003CPopReceipt\u003EAgAAAAMAAAAAAAAANb08W2i81gE=\u003C/PopReceipt\u003E\u003CTimeNextVisible\u003EMon, 16 Nov 2020 22:32:24 GMT\u003C/TimeNextVisible\u003E\u003CDequeueCount\u003E1\u003C/DequeueCount\u003E\u003CMessageText\u003Etest_content\u003C/MessageText\u003E\u003C/QueueMessage\u003E\u003C/QueueMessagesList\u003E" + }, + { + "RequestUri": "http://kasoboltest.queue.core.windows.net/test-queue-186b9a2d-2db9-6a0b-f23c-b2fe3ac42f03", + "RequestMethod": "DELETE", + "RequestHeaders": { + "Authorization": "Sanitized", + "traceparent": "00-5da478621cc71f449c6532f7f8b66cfb-3f68ec19c67bba44-00", + "User-Agent": [ + "azsdk-net-Storage.Queues/12.6.0-alpha.20201116.1", + "(.NET Core 4.6.29321.03; Microsoft Windows 10.0.19042 )" + ], + "x-ms-client-request-id": "f72e1f34-63f9-ea06-8cd1-55f5b41715b1", + "x-ms-date": "Mon, 16 Nov 2020 22:31:54 GMT", + "x-ms-return-client-request-id": "true", + "x-ms-version": "2018-11-09" + }, + "RequestBody": null, + "StatusCode": 204, + "ResponseHeaders": { + "Content-Length": "0", + "Date": "Mon, 16 Nov 2020 22:31:54 GMT", + "Server": [ + "Windows-Azure-Queue/1.0", + "Microsoft-HTTPAPI/2.0" + ], + "x-ms-request-id": "1b4f3078-2003-005b-6b68-bc538f000000", + "x-ms-version": "2018-11-09" + }, + "ResponseBody": [] + } + ], + "Variables": { + "RandomSeed": "209056997", + "Storage_TestConfigDefault": "ProductionTenant\nkasoboltest\nU2FuaXRpemVk\nhttp://kasoboltest.blob.core.windows.net\nhttp://kasoboltest.file.core.windows.net\nhttp://kasoboltest.queue.core.windows.net\nhttp://kasoboltest.table.core.windows.net\n\n\n\n\nhttp://kasoboltest-secondary.blob.core.windows.net\nhttp://kasoboltest-secondary.file.core.windows.net\nhttp://kasoboltest-secondary.queue.core.windows.net\nhttp://kasoboltest-secondary.table.core.windows.net\n\nSanitized\n\n\nCloud\nBlobEndpoint=http://kasoboltest.blob.core.windows.net/;QueueEndpoint=http://kasoboltest.queue.core.windows.net/;FileEndpoint=http://kasoboltest.file.core.windows.net/;BlobSecondaryEndpoint=http://kasoboltest-secondary.blob.core.windows.net/;QueueSecondaryEndpoint=http://kasoboltest-secondary.queue.core.windows.net/;FileSecondaryEndpoint=http://kasoboltest-secondary.file.core.windows.net/;AccountName=kasoboltest;AccountKey=Kg==;\nencryptionScope" + } +} \ No newline at end of file diff --git a/sdk/storage/Azure.Storage.Queues/tests/SessionRecords/QueueClientTests/FailsOnInvalidQueueMessageIfNoHandlerIsProvidedAsync.json b/sdk/storage/Azure.Storage.Queues/tests/SessionRecords/QueueClientTests/FailsOnInvalidQueueMessageIfNoHandlerIsProvidedAsync.json new file mode 100644 index 0000000000000..ba3c0397ce1a4 --- /dev/null +++ b/sdk/storage/Azure.Storage.Queues/tests/SessionRecords/QueueClientTests/FailsOnInvalidQueueMessageIfNoHandlerIsProvidedAsync.json @@ -0,0 +1,130 @@ +{ + "Entries": [ + { + "RequestUri": "http://kasoboltest.queue.core.windows.net/test-queue-92126722-b999-3233-5e98-9208c353523a", + "RequestMethod": "PUT", + "RequestHeaders": { + "Authorization": "Sanitized", + "traceparent": "00-b01927949d0fc94fbb277535c93922a6-91ecddd6177a8d47-00", + "User-Agent": [ + "azsdk-net-Storage.Queues/12.6.0-alpha.20201116.1", + "(.NET Core 4.6.29321.03; Microsoft Windows 10.0.19042 )" + ], + "x-ms-client-request-id": "f14369fc-369c-5fc6-e7e6-f22fbb544d0f", + "x-ms-date": "Mon, 16 Nov 2020 22:31:55 GMT", + "x-ms-return-client-request-id": "true", + "x-ms-version": "2018-11-09" + }, + "RequestBody": null, + "StatusCode": 201, + "ResponseHeaders": { + "Content-Length": "0", + "Date": "Mon, 16 Nov 2020 22:31:54 GMT", + "Server": [ + "Windows-Azure-Queue/1.0", + "Microsoft-HTTPAPI/2.0" + ], + "x-ms-request-id": "b8aa57f6-5003-0054-1568-bcbe79000000", + "x-ms-version": "2018-11-09" + }, + "ResponseBody": [] + }, + { + "RequestUri": "http://kasoboltest.queue.core.windows.net/test-queue-92126722-b999-3233-5e98-9208c353523a/messages", + "RequestMethod": "POST", + "RequestHeaders": { + "Authorization": "Sanitized", + "Content-Length": "68", + "Content-Type": "application/xml", + "traceparent": "00-af9394495bf4bf47a44b0f55c045599b-610ae585f319b44b-00", + "User-Agent": [ + "azsdk-net-Storage.Queues/12.6.0-alpha.20201116.1", + "(.NET Core 4.6.29321.03; Microsoft Windows 10.0.19042 )" + ], + "x-ms-client-request-id": "590cbb09-6010-1c9e-678e-0e4d21848b46", + "x-ms-date": "Mon, 16 Nov 2020 22:31:55 GMT", + "x-ms-return-client-request-id": "true", + "x-ms-version": "2018-11-09" + }, + "RequestBody": "\u003CQueueMessage\u003E\u003CMessageText\u003Etest_content\u003C/MessageText\u003E\u003C/QueueMessage\u003E", + "StatusCode": 201, + "ResponseHeaders": { + "Content-Type": "application/xml", + "Date": "Mon, 16 Nov 2020 22:31:54 GMT", + "Server": [ + "Windows-Azure-Queue/1.0", + "Microsoft-HTTPAPI/2.0" + ], + "Transfer-Encoding": "chunked", + "x-ms-request-id": "b8aa5802-5003-0054-1e68-bcbe79000000", + "x-ms-version": "2018-11-09" + }, + "ResponseBody": "\uFEFF\u003C?xml version=\u00221.0\u0022 encoding=\u0022utf-8\u0022?\u003E\u003CQueueMessagesList\u003E\u003CQueueMessage\u003E\u003CMessageId\u003E1a845464-2460-4987-9d1f-9d990608c2ba\u003C/MessageId\u003E\u003CInsertionTime\u003EMon, 16 Nov 2020 22:31:55 GMT\u003C/InsertionTime\u003E\u003CExpirationTime\u003EMon, 23 Nov 2020 22:31:55 GMT\u003C/ExpirationTime\u003E\u003CPopReceipt\u003EAgAAAAMAAAAAAAAAcEWMSWi81gE=\u003C/PopReceipt\u003E\u003CTimeNextVisible\u003EMon, 16 Nov 2020 22:31:55 GMT\u003C/TimeNextVisible\u003E\u003C/QueueMessage\u003E\u003C/QueueMessagesList\u003E" + }, + { + "RequestUri": "http://kasoboltest.queue.core.windows.net/test-queue-92126722-b999-3233-5e98-9208c353523a/messages", + "RequestMethod": "GET", + "RequestHeaders": { + "Authorization": "Sanitized", + "traceparent": "00-e0b5b97ff43b29469c10474850d7fa68-e9281952c043da47-00", + "User-Agent": [ + "azsdk-net-Storage.Queues/12.6.0-alpha.20201116.1", + "(.NET Core 4.6.29321.03; Microsoft Windows 10.0.19042 )" + ], + "x-ms-client-request-id": "ff26c9bc-f447-f3ff-ce1a-912f5fa2ee2f", + "x-ms-date": "Mon, 16 Nov 2020 22:31:55 GMT", + "x-ms-return-client-request-id": "true", + "x-ms-version": "2018-11-09" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "Cache-Control": "no-cache", + "Content-Type": "application/xml", + "Date": "Mon, 16 Nov 2020 22:31:54 GMT", + "Server": [ + "Windows-Azure-Queue/1.0", + "Microsoft-HTTPAPI/2.0" + ], + "Transfer-Encoding": "chunked", + "Vary": "Origin", + "x-ms-request-id": "2e4290a4-2003-003d-6c68-bce1d5000000", + "x-ms-version": "2018-11-09" + }, + "ResponseBody": "\uFEFF\u003C?xml version=\u00221.0\u0022 encoding=\u0022utf-8\u0022?\u003E\u003CQueueMessagesList\u003E\u003CQueueMessage\u003E\u003CMessageId\u003E1a845464-2460-4987-9d1f-9d990608c2ba\u003C/MessageId\u003E\u003CInsertionTime\u003EMon, 16 Nov 2020 22:31:55 GMT\u003C/InsertionTime\u003E\u003CExpirationTime\u003EMon, 23 Nov 2020 22:31:55 GMT\u003C/ExpirationTime\u003E\u003CPopReceipt\u003EAgAAAAMAAAAAAAAAVNV3W2i81gE=\u003C/PopReceipt\u003E\u003CTimeNextVisible\u003EMon, 16 Nov 2020 22:32:25 GMT\u003C/TimeNextVisible\u003E\u003CDequeueCount\u003E1\u003C/DequeueCount\u003E\u003CMessageText\u003Etest_content\u003C/MessageText\u003E\u003C/QueueMessage\u003E\u003C/QueueMessagesList\u003E" + }, + { + "RequestUri": "http://kasoboltest.queue.core.windows.net/test-queue-92126722-b999-3233-5e98-9208c353523a", + "RequestMethod": "DELETE", + "RequestHeaders": { + "Authorization": "Sanitized", + "traceparent": "00-69b9710861e4644384b8f096615eeaf7-6af111ff3c8cbe49-00", + "User-Agent": [ + "azsdk-net-Storage.Queues/12.6.0-alpha.20201116.1", + "(.NET Core 4.6.29321.03; Microsoft Windows 10.0.19042 )" + ], + "x-ms-client-request-id": "5790f2f6-8b5d-b5fe-e421-cde305e82ed7", + "x-ms-date": "Mon, 16 Nov 2020 22:31:55 GMT", + "x-ms-return-client-request-id": "true", + "x-ms-version": "2018-11-09" + }, + "RequestBody": null, + "StatusCode": 204, + "ResponseHeaders": { + "Content-Length": "0", + "Date": "Mon, 16 Nov 2020 22:31:54 GMT", + "Server": [ + "Windows-Azure-Queue/1.0", + "Microsoft-HTTPAPI/2.0" + ], + "x-ms-request-id": "b8aa5821-5003-0054-3d68-bcbe79000000", + "x-ms-version": "2018-11-09" + }, + "ResponseBody": [] + } + ], + "Variables": { + "RandomSeed": "1845332121", + "Storage_TestConfigDefault": "ProductionTenant\nkasoboltest\nU2FuaXRpemVk\nhttp://kasoboltest.blob.core.windows.net\nhttp://kasoboltest.file.core.windows.net\nhttp://kasoboltest.queue.core.windows.net\nhttp://kasoboltest.table.core.windows.net\n\n\n\n\nhttp://kasoboltest-secondary.blob.core.windows.net\nhttp://kasoboltest-secondary.file.core.windows.net\nhttp://kasoboltest-secondary.queue.core.windows.net\nhttp://kasoboltest-secondary.table.core.windows.net\n\nSanitized\n\n\nCloud\nBlobEndpoint=http://kasoboltest.blob.core.windows.net/;QueueEndpoint=http://kasoboltest.queue.core.windows.net/;FileEndpoint=http://kasoboltest.file.core.windows.net/;BlobSecondaryEndpoint=http://kasoboltest-secondary.blob.core.windows.net/;QueueSecondaryEndpoint=http://kasoboltest-secondary.queue.core.windows.net/;FileSecondaryEndpoint=http://kasoboltest-secondary.file.core.windows.net/;AccountName=kasoboltest;AccountKey=Kg==;\nencryptionScope" + } +} \ No newline at end of file From 74a3175757f4f8cbc22cfc58f92088d15ce741e6 Mon Sep 17 00:00:00 2001 From: Kamil Sobol Date: Mon, 16 Nov 2020 14:36:28 -0800 Subject: [PATCH 02/27] export api. --- .../api/Azure.Storage.Queues.netstandard2.0.cs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/sdk/storage/Azure.Storage.Queues/api/Azure.Storage.Queues.netstandard2.0.cs b/sdk/storage/Azure.Storage.Queues/api/Azure.Storage.Queues.netstandard2.0.cs index 7f31f9d62fb88..da51b98356bc7 100644 --- a/sdk/storage/Azure.Storage.Queues/api/Azure.Storage.Queues.netstandard2.0.cs +++ b/sdk/storage/Azure.Storage.Queues/api/Azure.Storage.Queues.netstandard2.0.cs @@ -1,5 +1,11 @@ namespace Azure.Storage.Queues { + public abstract partial class InvalidQueueMessageHandler + { + protected InvalidQueueMessageHandler() { } + public abstract void OnInvalidMessage(string messageId, string popReceipt, string rawBody, System.Threading.CancellationToken cancellationToken); + public abstract System.Threading.Tasks.Task OnInvalidMessageAsync(string messageId, string popReceipt, string rawBody, System.Threading.CancellationToken cancellationToken); + } public partial class QueueClient { protected QueueClient() { } @@ -68,6 +74,7 @@ public partial class QueueClientOptions : Azure.Core.ClientOptions { public QueueClientOptions(Azure.Storage.Queues.QueueClientOptions.ServiceVersion version = Azure.Storage.Queues.QueueClientOptions.ServiceVersion.V2020_02_10) { } public System.Uri GeoRedundantSecondaryUri { get { throw null; } set { } } + public Azure.Storage.Queues.InvalidQueueMessageHandler InvalidQueueMessageHandler { get { throw null; } set { } } public Azure.Storage.Queues.QueueMessageEncoding MessageEncoding { get { throw null; } set { } } public Azure.Storage.Queues.QueueClientOptions.ServiceVersion Version { get { throw null; } } public enum ServiceVersion From f0755e027ecbcf2dea476a2bebb609a8ecfdd315 Mon Sep 17 00:00:00 2001 From: Kamil Sobol Date: Thu, 19 Nov 2020 08:51:18 -0800 Subject: [PATCH 03/27] that works. --- .../src/InvalidQueueMessageHandler.cs | 12 ++++-------- sdk/storage/Azure.Storage.Queues/src/QueueClient.cs | 8 ++------ .../Azure.Storage.Queues/tests/QueueClientTests.cs | 6 +++--- 3 files changed, 9 insertions(+), 17 deletions(-) diff --git a/sdk/storage/Azure.Storage.Queues/src/InvalidQueueMessageHandler.cs b/sdk/storage/Azure.Storage.Queues/src/InvalidQueueMessageHandler.cs index 9d7e36ed8d0c6..850a66e2f09ef 100644 --- a/sdk/storage/Azure.Storage.Queues/src/InvalidQueueMessageHandler.cs +++ b/sdk/storage/Azure.Storage.Queues/src/InvalidQueueMessageHandler.cs @@ -14,19 +14,15 @@ public abstract class InvalidQueueMessageHandler /// /// TODO (kasobol-msft) add doc. /// - /// - /// - /// + /// /// - public abstract void OnInvalidMessage(string messageId, string popReceipt, string rawBody, CancellationToken cancellationToken); + public abstract void OnInvalidMessage(object rawMessage, CancellationToken cancellationToken); /// /// TODO (kasobol-msft) add doc. /// - /// - /// - /// + /// /// - public abstract Task OnInvalidMessageAsync(string messageId, string popReceipt, string rawBody, CancellationToken cancellationToken); + public abstract Task OnInvalidMessageAsync(object rawMessage, CancellationToken cancellationToken); } } diff --git a/sdk/storage/Azure.Storage.Queues/src/QueueClient.cs b/sdk/storage/Azure.Storage.Queues/src/QueueClient.cs index b7e7a3a424343..e1841f88ad026 100644 --- a/sdk/storage/Azure.Storage.Queues/src/QueueClient.cs +++ b/sdk/storage/Azure.Storage.Queues/src/QueueClient.cs @@ -1995,16 +1995,12 @@ private async Task ToQueueMessagesWithInvalidMessageHandling( if (async) { await _invalidQueueMessageHandler.OnInvalidMessageAsync( - dequeuedMessageItem.MessageId, - dequeuedMessageItem.PopReceipt, - dequeuedMessageItem.MessageText, + QueueMessage.ToQueueMessage(dequeuedMessageItem, QueueMessageEncoding.None), cancellationToken).ConfigureAwait(false); } else { _invalidQueueMessageHandler.OnInvalidMessage( - dequeuedMessageItem.MessageId, - dequeuedMessageItem.PopReceipt, - dequeuedMessageItem.MessageText, + QueueMessage.ToQueueMessage(dequeuedMessageItem, QueueMessageEncoding.None), cancellationToken); } } diff --git a/sdk/storage/Azure.Storage.Queues/tests/QueueClientTests.cs b/sdk/storage/Azure.Storage.Queues/tests/QueueClientTests.cs index e9808803ee960..0d782edb80e2e 100644 --- a/sdk/storage/Azure.Storage.Queues/tests/QueueClientTests.cs +++ b/sdk/storage/Azure.Storage.Queues/tests/QueueClientTests.cs @@ -23,7 +23,7 @@ namespace Azure.Storage.Queues.Test public class QueueClientTests : QueueTestBase { public QueueClientTests(bool async) - : base(async, RecordedTestMode.Record /* RecordedTestMode.Record /* to re-record */) + : base(async, null /* RecordedTestMode.Record /* to re-record */) { } @@ -818,12 +818,12 @@ public async Task CanHandleInvalidMessageAndReturnValid() if (IsAsync) { invalidQueueMessageHandlerMock.Verify( - m => m.OnInvalidMessageAsync(It.IsAny(), It.IsAny(), nonEncodedContent, It.IsAny())); + m => m.OnInvalidMessageAsync(It.Is(m => ((QueueMessage)m).Body.ToString() == nonEncodedContent), It.IsAny())); } else { invalidQueueMessageHandlerMock.Verify( - m => m.OnInvalidMessage(It.IsAny(), It.IsAny(), nonEncodedContent, It.IsAny())); + m => m.OnInvalidMessage(It.Is(m => ((QueueMessage)m).Body.ToString() == nonEncodedContent), It.IsAny())); } } From f91dc77175f25b3cd64d03bd26bad965561ae7a9 Mon Sep 17 00:00:00 2001 From: Kamil Sobol Date: Thu, 19 Nov 2020 09:00:38 -0800 Subject: [PATCH 04/27] handle peeked messages --- .../Azure.Storage.Queues/src/QueueClient.cs | 68 +++++++- .../tests/QueueClientTests.cs | 48 ++++++ ...dleInvalidPeekedMessageAndReturnValid.json | 162 ++++++++++++++++++ ...validPeekedMessageAndReturnValidAsync.json | 162 ++++++++++++++++++ ...lidPeekedMessageIfNoHandlerIsProvided.json | 130 ++++++++++++++ ...ekedMessageIfNoHandlerIsProvidedAsync.json | 130 ++++++++++++++ 6 files changed, 692 insertions(+), 8 deletions(-) create mode 100644 sdk/storage/Azure.Storage.Queues/tests/SessionRecords/QueueClientTests/CanHandleInvalidPeekedMessageAndReturnValid.json create mode 100644 sdk/storage/Azure.Storage.Queues/tests/SessionRecords/QueueClientTests/CanHandleInvalidPeekedMessageAndReturnValidAsync.json create mode 100644 sdk/storage/Azure.Storage.Queues/tests/SessionRecords/QueueClientTests/FailsOnInvalidPeekedMessageIfNoHandlerIsProvided.json create mode 100644 sdk/storage/Azure.Storage.Queues/tests/SessionRecords/QueueClientTests/FailsOnInvalidPeekedMessageIfNoHandlerIsProvidedAsync.json diff --git a/sdk/storage/Azure.Storage.Queues/src/QueueClient.cs b/sdk/storage/Azure.Storage.Queues/src/QueueClient.cs index e1841f88ad026..d873111d3357e 100644 --- a/sdk/storage/Azure.Storage.Queues/src/QueueClient.cs +++ b/sdk/storage/Azure.Storage.Queues/src/QueueClient.cs @@ -2258,8 +2258,11 @@ private async Task> PeekMessagesInternal( message: $"Uri: {MessagesUri}\n" + $"{nameof(maxMessages)}: {maxMessages}"); + DiagnosticScope scope = ClientDiagnostics.CreateScope(operationName); try { + scope.Start(); + Response> response = await QueueRestClient.Messages.PeekAsync( ClientDiagnostics, Pipeline, @@ -2276,29 +2279,78 @@ private async Task> PeekMessagesInternal( { return response.GetRawResponse().AsNoBodyResponse(); } - else if (UsingClientSideEncryption) - { - return Response.FromValue( - await new QueueClientSideDecryptor(ClientSideEncryption) - .ClientSideDecryptMessagesInternal(response.Value.Select(x => PeekedMessage.ToPeekedMessage(x, _messageEncoding)).ToArray(), async, cancellationToken).ConfigureAwait(false), - response.GetRawResponse()); - } else { - return Response.FromValue(response.Value.Select(x => PeekedMessage.ToPeekedMessage(x, _messageEncoding)).ToArray(), response.GetRawResponse()); + PeekedMessage[] peekedMessages; + if (_invalidQueueMessageHandler != null) + { + peekedMessages = await ToPeekedMessagesWithInvalidMessageHandling(response.Value, async, cancellationToken).ConfigureAwait(false); + } + else + { + peekedMessages = response.Value.Select(x => PeekedMessage.ToPeekedMessage(x, _messageEncoding)).ToArray(); + } + + if (UsingClientSideEncryption) + { + return Response.FromValue( + await new QueueClientSideDecryptor(ClientSideEncryption) + .ClientSideDecryptMessagesInternal(peekedMessages, async, cancellationToken).ConfigureAwait(false), + response.GetRawResponse()); + } + else + { + return Response.FromValue(peekedMessages, response.GetRawResponse()); + } } } catch (Exception ex) { + scope.Failed(ex); Pipeline.LogException(ex); throw; } finally { + scope.Dispose(); Pipeline.LogMethodExit(nameof(QueueClient)); } } } + + private async Task ToPeekedMessagesWithInvalidMessageHandling( + IEnumerable peekedMessageItems, + bool async, + CancellationToken cancellationToken) + { + List peekedMessages = new List(); + + foreach (var peekedMessageItem in peekedMessageItems) + { + try + { + peekedMessages.Add(PeekedMessage.ToPeekedMessage(peekedMessageItem, _messageEncoding)); + } + catch (FormatException) + { + if (async) + { + await _invalidQueueMessageHandler.OnInvalidMessageAsync( + PeekedMessage.ToPeekedMessage(peekedMessageItem, QueueMessageEncoding.None), + cancellationToken).ConfigureAwait(false); + } + else + { + _invalidQueueMessageHandler.OnInvalidMessage( + PeekedMessage.ToPeekedMessage(peekedMessageItem, QueueMessageEncoding.None), + cancellationToken); + } + } + } + + return peekedMessages.ToArray(); + } + #endregion PeekMessages /// diff --git a/sdk/storage/Azure.Storage.Queues/tests/QueueClientTests.cs b/sdk/storage/Azure.Storage.Queues/tests/QueueClientTests.cs index 0d782edb80e2e..69a4c03608ac4 100644 --- a/sdk/storage/Azure.Storage.Queues/tests/QueueClientTests.cs +++ b/sdk/storage/Azure.Storage.Queues/tests/QueueClientTests.cs @@ -758,6 +758,54 @@ public async Task DecodesPeekedMessage() Assert.AreEqual(messageText, receivedMessage.MessageText); } + [Test] + public async Task FailsOnInvalidPeekedMessageIfNoHandlerIsProvided() + { + // Arrange + await using DisposingQueue test = await GetTestQueueAsync(); + var encodingClient = GetEncodingClient(test.Queue.Name, QueueMessageEncoding.Base64); + var nonEncodedContent = "test_content"; + + await test.Queue.SendMessageAsync(nonEncodedContent); + + // Act + await TestHelper.AssertExpectedExceptionAsync( + encodingClient.PeekMessagesAsync(), + e => + { + StringAssert.Contains("The input is not a valid Base-64 string", e.Message); + }); + } + + [Test] + public async Task CanHandleInvalidPeekedMessageAndReturnValid() + { + // Arrange + Mock invalidQueueMessageHandlerMock = new Mock(); + await using DisposingQueue test = await GetTestQueueAsync(); + var encodingClient = GetEncodingClient(test.Queue.Name, QueueMessageEncoding.Base64, invalidQueueMessageHandlerMock.Object); + var nonEncodedContent = "test_content"; + + await test.Queue.SendMessageAsync(nonEncodedContent); + await encodingClient.SendMessageAsync(nonEncodedContent); + + // Act + PeekedMessage[] peekedMessages = await encodingClient.PeekMessagesAsync(10); + + // Assert + Assert.AreEqual(1, peekedMessages.Count()); + if (IsAsync) + { + invalidQueueMessageHandlerMock.Verify( + m => m.OnInvalidMessageAsync(It.Is(m => ((PeekedMessage)m).Body.ToString() == nonEncodedContent), It.IsAny())); + } + else + { + invalidQueueMessageHandlerMock.Verify( + m => m.OnInvalidMessage(It.Is(m => ((PeekedMessage)m).Body.ToString() == nonEncodedContent), It.IsAny())); + } + } + [Test] public async Task CanSendAndReceiveNonUTFBytes() { diff --git a/sdk/storage/Azure.Storage.Queues/tests/SessionRecords/QueueClientTests/CanHandleInvalidPeekedMessageAndReturnValid.json b/sdk/storage/Azure.Storage.Queues/tests/SessionRecords/QueueClientTests/CanHandleInvalidPeekedMessageAndReturnValid.json new file mode 100644 index 0000000000000..60e9265519517 --- /dev/null +++ b/sdk/storage/Azure.Storage.Queues/tests/SessionRecords/QueueClientTests/CanHandleInvalidPeekedMessageAndReturnValid.json @@ -0,0 +1,162 @@ +{ + "Entries": [ + { + "RequestUri": "http://kasoboltest.queue.core.windows.net/test-queue-23202ac5-0933-9847-100f-76a8c1575601", + "RequestMethod": "PUT", + "RequestHeaders": { + "Authorization": "Sanitized", + "traceparent": "00-68480f05053a5b4b9e2e75b5c0e343aa-7209da994a9e2943-00", + "User-Agent": [ + "azsdk-net-Storage.Queues/12.6.0-alpha.20201119.1", + "(.NET Core 4.6.29321.03; Microsoft Windows 10.0.19042 )" + ], + "x-ms-client-request-id": "73fe4bea-fb6b-d8ba-baf0-0708abce6a3c", + "x-ms-date": "Thu, 19 Nov 2020 17:00:03 GMT", + "x-ms-return-client-request-id": "true", + "x-ms-version": "2018-11-09" + }, + "RequestBody": null, + "StatusCode": 201, + "ResponseHeaders": { + "Content-Length": "0", + "Date": "Thu, 19 Nov 2020 17:00:03 GMT", + "Server": [ + "Windows-Azure-Queue/1.0", + "Microsoft-HTTPAPI/2.0" + ], + "x-ms-request-id": "9aef70e1-1003-001c-6995-be8ce4000000", + "x-ms-version": "2018-11-09" + }, + "ResponseBody": [] + }, + { + "RequestUri": "http://kasoboltest.queue.core.windows.net/test-queue-23202ac5-0933-9847-100f-76a8c1575601/messages", + "RequestMethod": "POST", + "RequestHeaders": { + "Authorization": "Sanitized", + "Content-Length": "68", + "Content-Type": "application/xml", + "traceparent": "00-77a4c544d56ada4a9b7d5097a3e11315-f8450828638d8049-00", + "User-Agent": [ + "azsdk-net-Storage.Queues/12.6.0-alpha.20201119.1", + "(.NET Core 4.6.29321.03; Microsoft Windows 10.0.19042 )" + ], + "x-ms-client-request-id": "75bdf63f-e259-3e96-f5e4-9cb23eb19441", + "x-ms-date": "Thu, 19 Nov 2020 17:00:04 GMT", + "x-ms-return-client-request-id": "true", + "x-ms-version": "2018-11-09" + }, + "RequestBody": "\u003CQueueMessage\u003E\u003CMessageText\u003Etest_content\u003C/MessageText\u003E\u003C/QueueMessage\u003E", + "StatusCode": 201, + "ResponseHeaders": { + "Content-Type": "application/xml", + "Date": "Thu, 19 Nov 2020 17:00:03 GMT", + "Server": [ + "Windows-Azure-Queue/1.0", + "Microsoft-HTTPAPI/2.0" + ], + "Transfer-Encoding": "chunked", + "x-ms-request-id": "9aef7128-1003-001c-2d95-be8ce4000000", + "x-ms-version": "2018-11-09" + }, + "ResponseBody": "\uFEFF\u003C?xml version=\u00221.0\u0022 encoding=\u0022utf-8\u0022?\u003E\u003CQueueMessagesList\u003E\u003CQueueMessage\u003E\u003CMessageId\u003Ea6b8d2e0-b02f-4279-a221-863036ce373c\u003C/MessageId\u003E\u003CInsertionTime\u003EThu, 19 Nov 2020 17:00:03 GMT\u003C/InsertionTime\u003E\u003CExpirationTime\u003EThu, 26 Nov 2020 17:00:03 GMT\u003C/ExpirationTime\u003E\u003CPopReceipt\u003EAgAAAAMAAAAAAAAAeOrQbJW\u002B1gE=\u003C/PopReceipt\u003E\u003CTimeNextVisible\u003EThu, 19 Nov 2020 17:00:03 GMT\u003C/TimeNextVisible\u003E\u003C/QueueMessage\u003E\u003C/QueueMessagesList\u003E" + }, + { + "RequestUri": "http://kasoboltest.queue.core.windows.net/test-queue-23202ac5-0933-9847-100f-76a8c1575601/messages", + "RequestMethod": "POST", + "RequestHeaders": { + "Authorization": "Sanitized", + "Content-Length": "72", + "Content-Type": "application/xml", + "traceparent": "00-faf0b824fd1cdb4583e077ed85e26fc8-8339f81b013cd540-00", + "User-Agent": [ + "azsdk-net-Storage.Queues/12.6.0-alpha.20201119.1", + "(.NET Core 4.6.29321.03; Microsoft Windows 10.0.19042 )" + ], + "x-ms-client-request-id": "b5c9a575-f510-24e2-8f78-1523ee0240be", + "x-ms-date": "Thu, 19 Nov 2020 17:00:04 GMT", + "x-ms-return-client-request-id": "true", + "x-ms-version": "2018-11-09" + }, + "RequestBody": "\u003CQueueMessage\u003E\u003CMessageText\u003EdGVzdF9jb250ZW50\u003C/MessageText\u003E\u003C/QueueMessage\u003E", + "StatusCode": 201, + "ResponseHeaders": { + "Content-Type": "application/xml", + "Date": "Thu, 19 Nov 2020 17:00:03 GMT", + "Server": [ + "Windows-Azure-Queue/1.0", + "Microsoft-HTTPAPI/2.0" + ], + "Transfer-Encoding": "chunked", + "x-ms-request-id": "e2669e54-a003-0063-6495-be12d6000000", + "x-ms-version": "2018-11-09" + }, + "ResponseBody": "\uFEFF\u003C?xml version=\u00221.0\u0022 encoding=\u0022utf-8\u0022?\u003E\u003CQueueMessagesList\u003E\u003CQueueMessage\u003E\u003CMessageId\u003Ecb6367e2-c93d-4f7b-8343-79e38f4d9fa8\u003C/MessageId\u003E\u003CInsertionTime\u003EThu, 19 Nov 2020 17:00:03 GMT\u003C/InsertionTime\u003E\u003CExpirationTime\u003EThu, 26 Nov 2020 17:00:03 GMT\u003C/ExpirationTime\u003E\u003CPopReceipt\u003EAgAAAAMAAAAAAAAAH4nabJW\u002B1gE=\u003C/PopReceipt\u003E\u003CTimeNextVisible\u003EThu, 19 Nov 2020 17:00:03 GMT\u003C/TimeNextVisible\u003E\u003C/QueueMessage\u003E\u003C/QueueMessagesList\u003E" + }, + { + "RequestUri": "http://kasoboltest.queue.core.windows.net/test-queue-23202ac5-0933-9847-100f-76a8c1575601/messages?peekonly=true\u0026numofmessages=10", + "RequestMethod": "GET", + "RequestHeaders": { + "Authorization": "Sanitized", + "traceparent": "00-ce99ed13f2dcdf4ba680b2952e06d7ad-96c5b68544a2a64a-00", + "User-Agent": [ + "azsdk-net-Storage.Queues/12.6.0-alpha.20201119.1", + "(.NET Core 4.6.29321.03; Microsoft Windows 10.0.19042 )" + ], + "x-ms-client-request-id": "993dba69-dfe7-3731-8d43-6780ae557194", + "x-ms-date": "Thu, 19 Nov 2020 17:00:04 GMT", + "x-ms-return-client-request-id": "true", + "x-ms-version": "2018-11-09" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "Cache-Control": "no-cache", + "Content-Type": "application/xml", + "Date": "Thu, 19 Nov 2020 17:00:03 GMT", + "Server": [ + "Windows-Azure-Queue/1.0", + "Microsoft-HTTPAPI/2.0" + ], + "Transfer-Encoding": "chunked", + "Vary": "Origin", + "x-ms-request-id": "e2669e59-a003-0063-6795-be12d6000000", + "x-ms-version": "2018-11-09" + }, + "ResponseBody": "\uFEFF\u003C?xml version=\u00221.0\u0022 encoding=\u0022utf-8\u0022?\u003E\u003CQueueMessagesList\u003E\u003CQueueMessage\u003E\u003CMessageId\u003Ea6b8d2e0-b02f-4279-a221-863036ce373c\u003C/MessageId\u003E\u003CInsertionTime\u003EThu, 19 Nov 2020 17:00:03 GMT\u003C/InsertionTime\u003E\u003CExpirationTime\u003EThu, 26 Nov 2020 17:00:03 GMT\u003C/ExpirationTime\u003E\u003CDequeueCount\u003E0\u003C/DequeueCount\u003E\u003CMessageText\u003Etest_content\u003C/MessageText\u003E\u003C/QueueMessage\u003E\u003CQueueMessage\u003E\u003CMessageId\u003Ecb6367e2-c93d-4f7b-8343-79e38f4d9fa8\u003C/MessageId\u003E\u003CInsertionTime\u003EThu, 19 Nov 2020 17:00:03 GMT\u003C/InsertionTime\u003E\u003CExpirationTime\u003EThu, 26 Nov 2020 17:00:03 GMT\u003C/ExpirationTime\u003E\u003CDequeueCount\u003E0\u003C/DequeueCount\u003E\u003CMessageText\u003EdGVzdF9jb250ZW50\u003C/MessageText\u003E\u003C/QueueMessage\u003E\u003C/QueueMessagesList\u003E" + }, + { + "RequestUri": "http://kasoboltest.queue.core.windows.net/test-queue-23202ac5-0933-9847-100f-76a8c1575601", + "RequestMethod": "DELETE", + "RequestHeaders": { + "Authorization": "Sanitized", + "traceparent": "00-a49cd366ea944b47b7f7b88d2908ebb6-c5aca86b03d94640-00", + "User-Agent": [ + "azsdk-net-Storage.Queues/12.6.0-alpha.20201119.1", + "(.NET Core 4.6.29321.03; Microsoft Windows 10.0.19042 )" + ], + "x-ms-client-request-id": "33ba3d21-a7c5-6cd7-a038-5e2d1ce7cb28", + "x-ms-date": "Thu, 19 Nov 2020 17:00:04 GMT", + "x-ms-return-client-request-id": "true", + "x-ms-version": "2018-11-09" + }, + "RequestBody": null, + "StatusCode": 204, + "ResponseHeaders": { + "Content-Length": "0", + "Date": "Thu, 19 Nov 2020 17:00:03 GMT", + "Server": [ + "Windows-Azure-Queue/1.0", + "Microsoft-HTTPAPI/2.0" + ], + "x-ms-request-id": "9aef71bd-1003-001c-3e95-be8ce4000000", + "x-ms-version": "2018-11-09" + }, + "ResponseBody": [] + } + ], + "Variables": { + "RandomSeed": "201465153", + "Storage_TestConfigDefault": "ProductionTenant\nkasoboltest\nU2FuaXRpemVk\nhttp://kasoboltest.blob.core.windows.net\nhttp://kasoboltest.file.core.windows.net\nhttp://kasoboltest.queue.core.windows.net\nhttp://kasoboltest.table.core.windows.net\n\n\n\n\nhttp://kasoboltest-secondary.blob.core.windows.net\nhttp://kasoboltest-secondary.file.core.windows.net\nhttp://kasoboltest-secondary.queue.core.windows.net\nhttp://kasoboltest-secondary.table.core.windows.net\n\nSanitized\n\n\nCloud\nBlobEndpoint=http://kasoboltest.blob.core.windows.net/;QueueEndpoint=http://kasoboltest.queue.core.windows.net/;FileEndpoint=http://kasoboltest.file.core.windows.net/;BlobSecondaryEndpoint=http://kasoboltest-secondary.blob.core.windows.net/;QueueSecondaryEndpoint=http://kasoboltest-secondary.queue.core.windows.net/;FileSecondaryEndpoint=http://kasoboltest-secondary.file.core.windows.net/;AccountName=kasoboltest;AccountKey=Kg==;\nencryptionScope" + } +} \ No newline at end of file diff --git a/sdk/storage/Azure.Storage.Queues/tests/SessionRecords/QueueClientTests/CanHandleInvalidPeekedMessageAndReturnValidAsync.json b/sdk/storage/Azure.Storage.Queues/tests/SessionRecords/QueueClientTests/CanHandleInvalidPeekedMessageAndReturnValidAsync.json new file mode 100644 index 0000000000000..d273f9153ed7b --- /dev/null +++ b/sdk/storage/Azure.Storage.Queues/tests/SessionRecords/QueueClientTests/CanHandleInvalidPeekedMessageAndReturnValidAsync.json @@ -0,0 +1,162 @@ +{ + "Entries": [ + { + "RequestUri": "http://kasoboltest.queue.core.windows.net/test-queue-a0e452de-885f-cc3b-2ed6-639ca012364d", + "RequestMethod": "PUT", + "RequestHeaders": { + "Authorization": "Sanitized", + "traceparent": "00-c53ea523a7ab0649bfc57e0263145116-f6ae995e02741346-00", + "User-Agent": [ + "azsdk-net-Storage.Queues/12.6.0-alpha.20201119.1", + "(.NET Core 4.6.29321.03; Microsoft Windows 10.0.19042 )" + ], + "x-ms-client-request-id": "e4febf01-7bdb-c0de-9aba-8c217ffb38ac", + "x-ms-date": "Thu, 19 Nov 2020 17:00:04 GMT", + "x-ms-return-client-request-id": "true", + "x-ms-version": "2018-11-09" + }, + "RequestBody": null, + "StatusCode": 201, + "ResponseHeaders": { + "Content-Length": "0", + "Date": "Thu, 19 Nov 2020 17:00:03 GMT", + "Server": [ + "Windows-Azure-Queue/1.0", + "Microsoft-HTTPAPI/2.0" + ], + "x-ms-request-id": "3db5c3ed-9003-0049-4495-be6793000000", + "x-ms-version": "2018-11-09" + }, + "ResponseBody": [] + }, + { + "RequestUri": "http://kasoboltest.queue.core.windows.net/test-queue-a0e452de-885f-cc3b-2ed6-639ca012364d/messages", + "RequestMethod": "POST", + "RequestHeaders": { + "Authorization": "Sanitized", + "Content-Length": "68", + "Content-Type": "application/xml", + "traceparent": "00-8ef2e5d66e616e45b528574787f76c06-daf814eab1a8fe49-00", + "User-Agent": [ + "azsdk-net-Storage.Queues/12.6.0-alpha.20201119.1", + "(.NET Core 4.6.29321.03; Microsoft Windows 10.0.19042 )" + ], + "x-ms-client-request-id": "e19abb5b-5214-d072-e67b-f02ef73c0ec3", + "x-ms-date": "Thu, 19 Nov 2020 17:00:04 GMT", + "x-ms-return-client-request-id": "true", + "x-ms-version": "2018-11-09" + }, + "RequestBody": "\u003CQueueMessage\u003E\u003CMessageText\u003Etest_content\u003C/MessageText\u003E\u003C/QueueMessage\u003E", + "StatusCode": 201, + "ResponseHeaders": { + "Content-Type": "application/xml", + "Date": "Thu, 19 Nov 2020 17:00:03 GMT", + "Server": [ + "Windows-Azure-Queue/1.0", + "Microsoft-HTTPAPI/2.0" + ], + "Transfer-Encoding": "chunked", + "x-ms-request-id": "3db5c401-9003-0049-5595-be6793000000", + "x-ms-version": "2018-11-09" + }, + "ResponseBody": "\uFEFF\u003C?xml version=\u00221.0\u0022 encoding=\u0022utf-8\u0022?\u003E\u003CQueueMessagesList\u003E\u003CQueueMessage\u003E\u003CMessageId\u003Ef30896b0-d340-4f3f-9215-17060e8d5908\u003C/MessageId\u003E\u003CInsertionTime\u003EThu, 19 Nov 2020 17:00:04 GMT\u003C/InsertionTime\u003E\u003CExpirationTime\u003EThu, 26 Nov 2020 17:00:04 GMT\u003C/ExpirationTime\u003E\u003CPopReceipt\u003EAgAAAAMAAAAAAAAAmPITbZW\u002B1gE=\u003C/PopReceipt\u003E\u003CTimeNextVisible\u003EThu, 19 Nov 2020 17:00:04 GMT\u003C/TimeNextVisible\u003E\u003C/QueueMessage\u003E\u003C/QueueMessagesList\u003E" + }, + { + "RequestUri": "http://kasoboltest.queue.core.windows.net/test-queue-a0e452de-885f-cc3b-2ed6-639ca012364d/messages", + "RequestMethod": "POST", + "RequestHeaders": { + "Authorization": "Sanitized", + "Content-Length": "72", + "Content-Type": "application/xml", + "traceparent": "00-c05c38356f5ac04387454ccfb07e5a9f-d0d385fc7ac9e542-00", + "User-Agent": [ + "azsdk-net-Storage.Queues/12.6.0-alpha.20201119.1", + "(.NET Core 4.6.29321.03; Microsoft Windows 10.0.19042 )" + ], + "x-ms-client-request-id": "c4c665ce-5660-2397-ac26-6ca2718e63b7", + "x-ms-date": "Thu, 19 Nov 2020 17:00:04 GMT", + "x-ms-return-client-request-id": "true", + "x-ms-version": "2018-11-09" + }, + "RequestBody": "\u003CQueueMessage\u003E\u003CMessageText\u003EdGVzdF9jb250ZW50\u003C/MessageText\u003E\u003C/QueueMessage\u003E", + "StatusCode": 201, + "ResponseHeaders": { + "Content-Type": "application/xml", + "Date": "Thu, 19 Nov 2020 17:00:03 GMT", + "Server": [ + "Windows-Azure-Queue/1.0", + "Microsoft-HTTPAPI/2.0" + ], + "Transfer-Encoding": "chunked", + "x-ms-request-id": "34749e9e-1003-0071-0c95-be26ca000000", + "x-ms-version": "2018-11-09" + }, + "ResponseBody": "\uFEFF\u003C?xml version=\u00221.0\u0022 encoding=\u0022utf-8\u0022?\u003E\u003CQueueMessagesList\u003E\u003CQueueMessage\u003E\u003CMessageId\u003E5d0e1710-f939-48d1-9a8f-3889baf42293\u003C/MessageId\u003E\u003CInsertionTime\u003EThu, 19 Nov 2020 17:00:04 GMT\u003C/InsertionTime\u003E\u003CExpirationTime\u003EThu, 26 Nov 2020 17:00:04 GMT\u003C/ExpirationTime\u003E\u003CPopReceipt\u003EAgAAAAMAAAAAAAAAYN8dbZW\u002B1gE=\u003C/PopReceipt\u003E\u003CTimeNextVisible\u003EThu, 19 Nov 2020 17:00:04 GMT\u003C/TimeNextVisible\u003E\u003C/QueueMessage\u003E\u003C/QueueMessagesList\u003E" + }, + { + "RequestUri": "http://kasoboltest.queue.core.windows.net/test-queue-a0e452de-885f-cc3b-2ed6-639ca012364d/messages?peekonly=true\u0026numofmessages=10", + "RequestMethod": "GET", + "RequestHeaders": { + "Authorization": "Sanitized", + "traceparent": "00-3c50091a0a055f4aa10463a5d196dc83-168bbf71d9a06244-00", + "User-Agent": [ + "azsdk-net-Storage.Queues/12.6.0-alpha.20201119.1", + "(.NET Core 4.6.29321.03; Microsoft Windows 10.0.19042 )" + ], + "x-ms-client-request-id": "915f6bfe-4a76-5662-008d-15ecbbe72d73", + "x-ms-date": "Thu, 19 Nov 2020 17:00:04 GMT", + "x-ms-return-client-request-id": "true", + "x-ms-version": "2018-11-09" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "Cache-Control": "no-cache", + "Content-Type": "application/xml", + "Date": "Thu, 19 Nov 2020 17:00:03 GMT", + "Server": [ + "Windows-Azure-Queue/1.0", + "Microsoft-HTTPAPI/2.0" + ], + "Transfer-Encoding": "chunked", + "Vary": "Origin", + "x-ms-request-id": "34749eb8-1003-0071-2295-be26ca000000", + "x-ms-version": "2018-11-09" + }, + "ResponseBody": "\uFEFF\u003C?xml version=\u00221.0\u0022 encoding=\u0022utf-8\u0022?\u003E\u003CQueueMessagesList\u003E\u003CQueueMessage\u003E\u003CMessageId\u003Ef30896b0-d340-4f3f-9215-17060e8d5908\u003C/MessageId\u003E\u003CInsertionTime\u003EThu, 19 Nov 2020 17:00:04 GMT\u003C/InsertionTime\u003E\u003CExpirationTime\u003EThu, 26 Nov 2020 17:00:04 GMT\u003C/ExpirationTime\u003E\u003CDequeueCount\u003E0\u003C/DequeueCount\u003E\u003CMessageText\u003Etest_content\u003C/MessageText\u003E\u003C/QueueMessage\u003E\u003CQueueMessage\u003E\u003CMessageId\u003E5d0e1710-f939-48d1-9a8f-3889baf42293\u003C/MessageId\u003E\u003CInsertionTime\u003EThu, 19 Nov 2020 17:00:04 GMT\u003C/InsertionTime\u003E\u003CExpirationTime\u003EThu, 26 Nov 2020 17:00:04 GMT\u003C/ExpirationTime\u003E\u003CDequeueCount\u003E0\u003C/DequeueCount\u003E\u003CMessageText\u003EdGVzdF9jb250ZW50\u003C/MessageText\u003E\u003C/QueueMessage\u003E\u003C/QueueMessagesList\u003E" + }, + { + "RequestUri": "http://kasoboltest.queue.core.windows.net/test-queue-a0e452de-885f-cc3b-2ed6-639ca012364d", + "RequestMethod": "DELETE", + "RequestHeaders": { + "Authorization": "Sanitized", + "traceparent": "00-785d8490ff76de41a055af405939d5c1-73a650beed285a42-00", + "User-Agent": [ + "azsdk-net-Storage.Queues/12.6.0-alpha.20201119.1", + "(.NET Core 4.6.29321.03; Microsoft Windows 10.0.19042 )" + ], + "x-ms-client-request-id": "06a4ebf0-d12e-fc41-ba76-aad714287749", + "x-ms-date": "Thu, 19 Nov 2020 17:00:04 GMT", + "x-ms-return-client-request-id": "true", + "x-ms-version": "2018-11-09" + }, + "RequestBody": null, + "StatusCode": 204, + "ResponseHeaders": { + "Content-Length": "0", + "Date": "Thu, 19 Nov 2020 17:00:04 GMT", + "Server": [ + "Windows-Azure-Queue/1.0", + "Microsoft-HTTPAPI/2.0" + ], + "x-ms-request-id": "3db5c448-9003-0049-1295-be6793000000", + "x-ms-version": "2018-11-09" + }, + "ResponseBody": [] + } + ], + "Variables": { + "RandomSeed": "1524474571", + "Storage_TestConfigDefault": "ProductionTenant\nkasoboltest\nU2FuaXRpemVk\nhttp://kasoboltest.blob.core.windows.net\nhttp://kasoboltest.file.core.windows.net\nhttp://kasoboltest.queue.core.windows.net\nhttp://kasoboltest.table.core.windows.net\n\n\n\n\nhttp://kasoboltest-secondary.blob.core.windows.net\nhttp://kasoboltest-secondary.file.core.windows.net\nhttp://kasoboltest-secondary.queue.core.windows.net\nhttp://kasoboltest-secondary.table.core.windows.net\n\nSanitized\n\n\nCloud\nBlobEndpoint=http://kasoboltest.blob.core.windows.net/;QueueEndpoint=http://kasoboltest.queue.core.windows.net/;FileEndpoint=http://kasoboltest.file.core.windows.net/;BlobSecondaryEndpoint=http://kasoboltest-secondary.blob.core.windows.net/;QueueSecondaryEndpoint=http://kasoboltest-secondary.queue.core.windows.net/;FileSecondaryEndpoint=http://kasoboltest-secondary.file.core.windows.net/;AccountName=kasoboltest;AccountKey=Kg==;\nencryptionScope" + } +} \ No newline at end of file diff --git a/sdk/storage/Azure.Storage.Queues/tests/SessionRecords/QueueClientTests/FailsOnInvalidPeekedMessageIfNoHandlerIsProvided.json b/sdk/storage/Azure.Storage.Queues/tests/SessionRecords/QueueClientTests/FailsOnInvalidPeekedMessageIfNoHandlerIsProvided.json new file mode 100644 index 0000000000000..a1491955043b0 --- /dev/null +++ b/sdk/storage/Azure.Storage.Queues/tests/SessionRecords/QueueClientTests/FailsOnInvalidPeekedMessageIfNoHandlerIsProvided.json @@ -0,0 +1,130 @@ +{ + "Entries": [ + { + "RequestUri": "http://kasoboltest.queue.core.windows.net/test-queue-a526a502-4001-605b-b7da-4dca08918a1f", + "RequestMethod": "PUT", + "RequestHeaders": { + "Authorization": "Sanitized", + "traceparent": "00-6efde924efa19245a6ac4eb7caf41008-240b194335f58f49-00", + "User-Agent": [ + "azsdk-net-Storage.Queues/12.6.0-alpha.20201119.1", + "(.NET Core 4.6.29321.03; Microsoft Windows 10.0.19042 )" + ], + "x-ms-client-request-id": "fd0bc578-d298-e78b-db47-57c65a681c37", + "x-ms-date": "Thu, 19 Nov 2020 16:59:55 GMT", + "x-ms-return-client-request-id": "true", + "x-ms-version": "2018-11-09" + }, + "RequestBody": null, + "StatusCode": 201, + "ResponseHeaders": { + "Content-Length": "0", + "Date": "Thu, 19 Nov 2020 16:59:54 GMT", + "Server": [ + "Windows-Azure-Queue/1.0", + "Microsoft-HTTPAPI/2.0" + ], + "x-ms-request-id": "0d9dc060-a003-0027-2095-beceba000000", + "x-ms-version": "2018-11-09" + }, + "ResponseBody": [] + }, + { + "RequestUri": "http://kasoboltest.queue.core.windows.net/test-queue-a526a502-4001-605b-b7da-4dca08918a1f/messages", + "RequestMethod": "POST", + "RequestHeaders": { + "Authorization": "Sanitized", + "Content-Length": "68", + "Content-Type": "application/xml", + "traceparent": "00-ec854659a2a1db4fb9f1f8386820b178-f19ed45843c26b4e-00", + "User-Agent": [ + "azsdk-net-Storage.Queues/12.6.0-alpha.20201119.1", + "(.NET Core 4.6.29321.03; Microsoft Windows 10.0.19042 )" + ], + "x-ms-client-request-id": "4251e8ca-8c85-f587-2f79-8b96f0068ffb", + "x-ms-date": "Thu, 19 Nov 2020 16:59:55 GMT", + "x-ms-return-client-request-id": "true", + "x-ms-version": "2018-11-09" + }, + "RequestBody": "\u003CQueueMessage\u003E\u003CMessageText\u003Etest_content\u003C/MessageText\u003E\u003C/QueueMessage\u003E", + "StatusCode": 201, + "ResponseHeaders": { + "Content-Type": "application/xml", + "Date": "Thu, 19 Nov 2020 16:59:54 GMT", + "Server": [ + "Windows-Azure-Queue/1.0", + "Microsoft-HTTPAPI/2.0" + ], + "Transfer-Encoding": "chunked", + "x-ms-request-id": "0d9dc0a0-a003-0027-5695-beceba000000", + "x-ms-version": "2018-11-09" + }, + "ResponseBody": "\uFEFF\u003C?xml version=\u00221.0\u0022 encoding=\u0022utf-8\u0022?\u003E\u003CQueueMessagesList\u003E\u003CQueueMessage\u003E\u003CMessageId\u003Ed675e8af-4373-4817-8e9f-575786d808a3\u003C/MessageId\u003E\u003CInsertionTime\u003EThu, 19 Nov 2020 16:59:55 GMT\u003C/InsertionTime\u003E\u003CExpirationTime\u003EThu, 26 Nov 2020 16:59:55 GMT\u003C/ExpirationTime\u003E\u003CPopReceipt\u003EAgAAAAMAAAAAAAAABJ2bZ5W\u002B1gE=\u003C/PopReceipt\u003E\u003CTimeNextVisible\u003EThu, 19 Nov 2020 16:59:55 GMT\u003C/TimeNextVisible\u003E\u003C/QueueMessage\u003E\u003C/QueueMessagesList\u003E" + }, + { + "RequestUri": "http://kasoboltest.queue.core.windows.net/test-queue-a526a502-4001-605b-b7da-4dca08918a1f/messages?peekonly=true", + "RequestMethod": "GET", + "RequestHeaders": { + "Authorization": "Sanitized", + "traceparent": "00-92692d8508d45a449a62a33968d2e3dd-a5c86bde2bcad84f-00", + "User-Agent": [ + "azsdk-net-Storage.Queues/12.6.0-alpha.20201119.1", + "(.NET Core 4.6.29321.03; Microsoft Windows 10.0.19042 )" + ], + "x-ms-client-request-id": "71fc6e09-da16-7bb1-0df3-4f12cf42cbd1", + "x-ms-date": "Thu, 19 Nov 2020 16:59:55 GMT", + "x-ms-return-client-request-id": "true", + "x-ms-version": "2018-11-09" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "Cache-Control": "no-cache", + "Content-Type": "application/xml", + "Date": "Thu, 19 Nov 2020 16:59:54 GMT", + "Server": [ + "Windows-Azure-Queue/1.0", + "Microsoft-HTTPAPI/2.0" + ], + "Transfer-Encoding": "chunked", + "Vary": "Origin", + "x-ms-request-id": "8885a00f-1003-0035-4895-befaa6000000", + "x-ms-version": "2018-11-09" + }, + "ResponseBody": "\uFEFF\u003C?xml version=\u00221.0\u0022 encoding=\u0022utf-8\u0022?\u003E\u003CQueueMessagesList\u003E\u003CQueueMessage\u003E\u003CMessageId\u003Ed675e8af-4373-4817-8e9f-575786d808a3\u003C/MessageId\u003E\u003CInsertionTime\u003EThu, 19 Nov 2020 16:59:55 GMT\u003C/InsertionTime\u003E\u003CExpirationTime\u003EThu, 26 Nov 2020 16:59:55 GMT\u003C/ExpirationTime\u003E\u003CDequeueCount\u003E0\u003C/DequeueCount\u003E\u003CMessageText\u003Etest_content\u003C/MessageText\u003E\u003C/QueueMessage\u003E\u003C/QueueMessagesList\u003E" + }, + { + "RequestUri": "http://kasoboltest.queue.core.windows.net/test-queue-a526a502-4001-605b-b7da-4dca08918a1f", + "RequestMethod": "DELETE", + "RequestHeaders": { + "Authorization": "Sanitized", + "traceparent": "00-fc0790481d9dc3468a4575a5e72b8296-4667c041fe719f4d-00", + "User-Agent": [ + "azsdk-net-Storage.Queues/12.6.0-alpha.20201119.1", + "(.NET Core 4.6.29321.03; Microsoft Windows 10.0.19042 )" + ], + "x-ms-client-request-id": "818c963c-1d0a-d1e4-acf1-7ef341c64eab", + "x-ms-date": "Thu, 19 Nov 2020 16:59:55 GMT", + "x-ms-return-client-request-id": "true", + "x-ms-version": "2018-11-09" + }, + "RequestBody": null, + "StatusCode": 204, + "ResponseHeaders": { + "Content-Length": "0", + "Date": "Thu, 19 Nov 2020 16:59:55 GMT", + "Server": [ + "Windows-Azure-Queue/1.0", + "Microsoft-HTTPAPI/2.0" + ], + "x-ms-request-id": "0d9dc116-a003-0027-4995-beceba000000", + "x-ms-version": "2018-11-09" + }, + "ResponseBody": [] + } + ], + "Variables": { + "RandomSeed": "531594792", + "Storage_TestConfigDefault": "ProductionTenant\nkasoboltest\nU2FuaXRpemVk\nhttp://kasoboltest.blob.core.windows.net\nhttp://kasoboltest.file.core.windows.net\nhttp://kasoboltest.queue.core.windows.net\nhttp://kasoboltest.table.core.windows.net\n\n\n\n\nhttp://kasoboltest-secondary.blob.core.windows.net\nhttp://kasoboltest-secondary.file.core.windows.net\nhttp://kasoboltest-secondary.queue.core.windows.net\nhttp://kasoboltest-secondary.table.core.windows.net\n\nSanitized\n\n\nCloud\nBlobEndpoint=http://kasoboltest.blob.core.windows.net/;QueueEndpoint=http://kasoboltest.queue.core.windows.net/;FileEndpoint=http://kasoboltest.file.core.windows.net/;BlobSecondaryEndpoint=http://kasoboltest-secondary.blob.core.windows.net/;QueueSecondaryEndpoint=http://kasoboltest-secondary.queue.core.windows.net/;FileSecondaryEndpoint=http://kasoboltest-secondary.file.core.windows.net/;AccountName=kasoboltest;AccountKey=Kg==;\nencryptionScope" + } +} \ No newline at end of file diff --git a/sdk/storage/Azure.Storage.Queues/tests/SessionRecords/QueueClientTests/FailsOnInvalidPeekedMessageIfNoHandlerIsProvidedAsync.json b/sdk/storage/Azure.Storage.Queues/tests/SessionRecords/QueueClientTests/FailsOnInvalidPeekedMessageIfNoHandlerIsProvidedAsync.json new file mode 100644 index 0000000000000..e9e03f2adc0c9 --- /dev/null +++ b/sdk/storage/Azure.Storage.Queues/tests/SessionRecords/QueueClientTests/FailsOnInvalidPeekedMessageIfNoHandlerIsProvidedAsync.json @@ -0,0 +1,130 @@ +{ + "Entries": [ + { + "RequestUri": "http://kasoboltest.queue.core.windows.net/test-queue-cc4458e5-ec24-cc32-7616-10a6fad89eb8", + "RequestMethod": "PUT", + "RequestHeaders": { + "Authorization": "Sanitized", + "traceparent": "00-fcc6c7dacdab97408847dd5de434a153-3ca91197be7bc54a-00", + "User-Agent": [ + "azsdk-net-Storage.Queues/12.6.0-alpha.20201119.1", + "(.NET Core 4.6.29321.03; Microsoft Windows 10.0.19042 )" + ], + "x-ms-client-request-id": "b072c23b-d1f7-bf0e-6c08-e90c9ba03df9", + "x-ms-date": "Thu, 19 Nov 2020 16:59:55 GMT", + "x-ms-return-client-request-id": "true", + "x-ms-version": "2018-11-09" + }, + "RequestBody": null, + "StatusCode": 201, + "ResponseHeaders": { + "Content-Length": "0", + "Date": "Thu, 19 Nov 2020 16:59:55 GMT", + "Server": [ + "Windows-Azure-Queue/1.0", + "Microsoft-HTTPAPI/2.0" + ], + "x-ms-request-id": "6287b497-0003-006e-3995-befdda000000", + "x-ms-version": "2018-11-09" + }, + "ResponseBody": [] + }, + { + "RequestUri": "http://kasoboltest.queue.core.windows.net/test-queue-cc4458e5-ec24-cc32-7616-10a6fad89eb8/messages", + "RequestMethod": "POST", + "RequestHeaders": { + "Authorization": "Sanitized", + "Content-Length": "68", + "Content-Type": "application/xml", + "traceparent": "00-a15be0cc23ab7c4887cfbdef1a401b03-ceda4396da0a554e-00", + "User-Agent": [ + "azsdk-net-Storage.Queues/12.6.0-alpha.20201119.1", + "(.NET Core 4.6.29321.03; Microsoft Windows 10.0.19042 )" + ], + "x-ms-client-request-id": "376a55e0-ed65-bbc0-d569-0b304b5c692b", + "x-ms-date": "Thu, 19 Nov 2020 16:59:55 GMT", + "x-ms-return-client-request-id": "true", + "x-ms-version": "2018-11-09" + }, + "RequestBody": "\u003CQueueMessage\u003E\u003CMessageText\u003Etest_content\u003C/MessageText\u003E\u003C/QueueMessage\u003E", + "StatusCode": 201, + "ResponseHeaders": { + "Content-Type": "application/xml", + "Date": "Thu, 19 Nov 2020 16:59:55 GMT", + "Server": [ + "Windows-Azure-Queue/1.0", + "Microsoft-HTTPAPI/2.0" + ], + "Transfer-Encoding": "chunked", + "x-ms-request-id": "6287b4b7-0003-006e-5795-befdda000000", + "x-ms-version": "2018-11-09" + }, + "ResponseBody": "\uFEFF\u003C?xml version=\u00221.0\u0022 encoding=\u0022utf-8\u0022?\u003E\u003CQueueMessagesList\u003E\u003CQueueMessage\u003E\u003CMessageId\u003Eaae6a382-e783-4da5-a7bf-0b31fe0fca3a\u003C/MessageId\u003E\u003CInsertionTime\u003EThu, 19 Nov 2020 16:59:55 GMT\u003C/InsertionTime\u003E\u003CExpirationTime\u003EThu, 26 Nov 2020 16:59:55 GMT\u003C/ExpirationTime\u003E\u003CPopReceipt\u003EAgAAAAMAAAAAAAAAZa7PZ5W\u002B1gE=\u003C/PopReceipt\u003E\u003CTimeNextVisible\u003EThu, 19 Nov 2020 16:59:55 GMT\u003C/TimeNextVisible\u003E\u003C/QueueMessage\u003E\u003C/QueueMessagesList\u003E" + }, + { + "RequestUri": "http://kasoboltest.queue.core.windows.net/test-queue-cc4458e5-ec24-cc32-7616-10a6fad89eb8/messages?peekonly=true", + "RequestMethod": "GET", + "RequestHeaders": { + "Authorization": "Sanitized", + "traceparent": "00-cd79b00710ed174786d0ab4ef149f92d-6ae586c8ee01aa47-00", + "User-Agent": [ + "azsdk-net-Storage.Queues/12.6.0-alpha.20201119.1", + "(.NET Core 4.6.29321.03; Microsoft Windows 10.0.19042 )" + ], + "x-ms-client-request-id": "462b07bf-0636-9994-c3fd-48e096896492", + "x-ms-date": "Thu, 19 Nov 2020 16:59:55 GMT", + "x-ms-return-client-request-id": "true", + "x-ms-version": "2018-11-09" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "Cache-Control": "no-cache", + "Content-Type": "application/xml", + "Date": "Thu, 19 Nov 2020 16:59:55 GMT", + "Server": [ + "Windows-Azure-Queue/1.0", + "Microsoft-HTTPAPI/2.0" + ], + "Transfer-Encoding": "chunked", + "Vary": "Origin", + "x-ms-request-id": "01b01ab4-8003-0030-3295-be0ed9000000", + "x-ms-version": "2018-11-09" + }, + "ResponseBody": "\uFEFF\u003C?xml version=\u00221.0\u0022 encoding=\u0022utf-8\u0022?\u003E\u003CQueueMessagesList\u003E\u003CQueueMessage\u003E\u003CMessageId\u003Eaae6a382-e783-4da5-a7bf-0b31fe0fca3a\u003C/MessageId\u003E\u003CInsertionTime\u003EThu, 19 Nov 2020 16:59:55 GMT\u003C/InsertionTime\u003E\u003CExpirationTime\u003EThu, 26 Nov 2020 16:59:55 GMT\u003C/ExpirationTime\u003E\u003CDequeueCount\u003E0\u003C/DequeueCount\u003E\u003CMessageText\u003Etest_content\u003C/MessageText\u003E\u003C/QueueMessage\u003E\u003C/QueueMessagesList\u003E" + }, + { + "RequestUri": "http://kasoboltest.queue.core.windows.net/test-queue-cc4458e5-ec24-cc32-7616-10a6fad89eb8", + "RequestMethod": "DELETE", + "RequestHeaders": { + "Authorization": "Sanitized", + "traceparent": "00-1702f238935ca248bd0422d7d17a7d38-c0957f2e2f889146-00", + "User-Agent": [ + "azsdk-net-Storage.Queues/12.6.0-alpha.20201119.1", + "(.NET Core 4.6.29321.03; Microsoft Windows 10.0.19042 )" + ], + "x-ms-client-request-id": "4371298a-2231-fdf4-7d87-3adecf91037e", + "x-ms-date": "Thu, 19 Nov 2020 16:59:55 GMT", + "x-ms-return-client-request-id": "true", + "x-ms-version": "2018-11-09" + }, + "RequestBody": null, + "StatusCode": 204, + "ResponseHeaders": { + "Content-Length": "0", + "Date": "Thu, 19 Nov 2020 16:59:55 GMT", + "Server": [ + "Windows-Azure-Queue/1.0", + "Microsoft-HTTPAPI/2.0" + ], + "x-ms-request-id": "6287b4f4-0003-006e-1495-befdda000000", + "x-ms-version": "2018-11-09" + }, + "ResponseBody": [] + } + ], + "Variables": { + "RandomSeed": "907209100", + "Storage_TestConfigDefault": "ProductionTenant\nkasoboltest\nU2FuaXRpemVk\nhttp://kasoboltest.blob.core.windows.net\nhttp://kasoboltest.file.core.windows.net\nhttp://kasoboltest.queue.core.windows.net\nhttp://kasoboltest.table.core.windows.net\n\n\n\n\nhttp://kasoboltest-secondary.blob.core.windows.net\nhttp://kasoboltest-secondary.file.core.windows.net\nhttp://kasoboltest-secondary.queue.core.windows.net\nhttp://kasoboltest-secondary.table.core.windows.net\n\nSanitized\n\n\nCloud\nBlobEndpoint=http://kasoboltest.blob.core.windows.net/;QueueEndpoint=http://kasoboltest.queue.core.windows.net/;FileEndpoint=http://kasoboltest.file.core.windows.net/;BlobSecondaryEndpoint=http://kasoboltest-secondary.blob.core.windows.net/;QueueSecondaryEndpoint=http://kasoboltest-secondary.queue.core.windows.net/;FileSecondaryEndpoint=http://kasoboltest-secondary.file.core.windows.net/;AccountName=kasoboltest;AccountKey=Kg==;\nencryptionScope" + } +} \ No newline at end of file From fe4a3cee49944599e39810d4e7999623ec8e84a3 Mon Sep 17 00:00:00 2001 From: Kamil Sobol Date: Thu, 19 Nov 2020 09:01:24 -0800 Subject: [PATCH 05/27] api --- .../api/Azure.Storage.Queues.netstandard2.0.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sdk/storage/Azure.Storage.Queues/api/Azure.Storage.Queues.netstandard2.0.cs b/sdk/storage/Azure.Storage.Queues/api/Azure.Storage.Queues.netstandard2.0.cs index da51b98356bc7..e73b0bfade4d9 100644 --- a/sdk/storage/Azure.Storage.Queues/api/Azure.Storage.Queues.netstandard2.0.cs +++ b/sdk/storage/Azure.Storage.Queues/api/Azure.Storage.Queues.netstandard2.0.cs @@ -3,8 +3,8 @@ namespace Azure.Storage.Queues public abstract partial class InvalidQueueMessageHandler { protected InvalidQueueMessageHandler() { } - public abstract void OnInvalidMessage(string messageId, string popReceipt, string rawBody, System.Threading.CancellationToken cancellationToken); - public abstract System.Threading.Tasks.Task OnInvalidMessageAsync(string messageId, string popReceipt, string rawBody, System.Threading.CancellationToken cancellationToken); + public abstract void OnInvalidMessage(object rawMessage, System.Threading.CancellationToken cancellationToken); + public abstract System.Threading.Tasks.Task OnInvalidMessageAsync(object rawMessage, System.Threading.CancellationToken cancellationToken); } public partial class QueueClient { From 2b92bbb95ae4ee8462b02f3ad23e040189b4fadc Mon Sep 17 00:00:00 2001 From: Kamil Sobol Date: Fri, 4 Dec 2020 07:58:51 -0800 Subject: [PATCH 06/27] post merge. --- sdk/storage/Azure.Storage.Queues/src/QueueClient.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sdk/storage/Azure.Storage.Queues/src/QueueClient.cs b/sdk/storage/Azure.Storage.Queues/src/QueueClient.cs index bae8e06be9372..0e2d1ebead802 100644 --- a/sdk/storage/Azure.Storage.Queues/src/QueueClient.cs +++ b/sdk/storage/Azure.Storage.Queues/src/QueueClient.cs @@ -409,7 +409,8 @@ protected internal virtual QueueClient WithClientSideEncryptionOptionsCore(Clien Version, ClientDiagnostics, clientSideEncryptionOptions, - MessageEncoding); + MessageEncoding, + InvalidQueueMessageHandler); } #region Create From cf909185b1ece117e5838ec0b331a4e5fae082dc Mon Sep 17 00:00:00 2001 From: Kamil Sobol Date: Fri, 4 Dec 2020 08:03:18 -0800 Subject: [PATCH 07/27] propagate queueclient. --- .../api/Azure.Storage.Queues.netstandard2.0.cs | 4 ++-- .../src/InvalidQueueMessageHandler.cs | 6 ++++-- sdk/storage/Azure.Storage.Queues/src/QueueClient.cs | 4 ++++ .../Azure.Storage.Queues/tests/QueueClientTests.cs | 8 ++++---- 4 files changed, 14 insertions(+), 8 deletions(-) diff --git a/sdk/storage/Azure.Storage.Queues/api/Azure.Storage.Queues.netstandard2.0.cs b/sdk/storage/Azure.Storage.Queues/api/Azure.Storage.Queues.netstandard2.0.cs index 97a0281ffa3e6..ea1eb47c6f9f0 100644 --- a/sdk/storage/Azure.Storage.Queues/api/Azure.Storage.Queues.netstandard2.0.cs +++ b/sdk/storage/Azure.Storage.Queues/api/Azure.Storage.Queues.netstandard2.0.cs @@ -3,8 +3,8 @@ namespace Azure.Storage.Queues public abstract partial class InvalidQueueMessageHandler { protected InvalidQueueMessageHandler() { } - public abstract void OnInvalidMessage(object rawMessage, System.Threading.CancellationToken cancellationToken); - public abstract System.Threading.Tasks.Task OnInvalidMessageAsync(object rawMessage, System.Threading.CancellationToken cancellationToken); + public abstract void OnInvalidMessage(Azure.Storage.Queues.QueueClient queueClient, object rawMessage, System.Threading.CancellationToken cancellationToken); + public abstract System.Threading.Tasks.Task OnInvalidMessageAsync(Azure.Storage.Queues.QueueClient queueClient, object rawMessage, System.Threading.CancellationToken cancellationToken); } public partial class QueueClient { diff --git a/sdk/storage/Azure.Storage.Queues/src/InvalidQueueMessageHandler.cs b/sdk/storage/Azure.Storage.Queues/src/InvalidQueueMessageHandler.cs index 850a66e2f09ef..b710af212e990 100644 --- a/sdk/storage/Azure.Storage.Queues/src/InvalidQueueMessageHandler.cs +++ b/sdk/storage/Azure.Storage.Queues/src/InvalidQueueMessageHandler.cs @@ -14,15 +14,17 @@ public abstract class InvalidQueueMessageHandler /// /// TODO (kasobol-msft) add doc. /// + /// /// /// - public abstract void OnInvalidMessage(object rawMessage, CancellationToken cancellationToken); + public abstract void OnInvalidMessage(QueueClient queueClient, object rawMessage, CancellationToken cancellationToken); /// /// TODO (kasobol-msft) add doc. /// + /// /// /// - public abstract Task OnInvalidMessageAsync(object rawMessage, CancellationToken cancellationToken); + public abstract Task OnInvalidMessageAsync(QueueClient queueClient, object rawMessage, CancellationToken cancellationToken); } } diff --git a/sdk/storage/Azure.Storage.Queues/src/QueueClient.cs b/sdk/storage/Azure.Storage.Queues/src/QueueClient.cs index 0e2d1ebead802..402dadbe93642 100644 --- a/sdk/storage/Azure.Storage.Queues/src/QueueClient.cs +++ b/sdk/storage/Azure.Storage.Queues/src/QueueClient.cs @@ -2019,11 +2019,13 @@ private async Task ToQueueMessagesWithInvalidMessageHandling( if (async) { await _invalidQueueMessageHandler.OnInvalidMessageAsync( + this, QueueMessage.ToQueueMessage(dequeuedMessageItem, QueueMessageEncoding.None), cancellationToken).ConfigureAwait(false); } else { _invalidQueueMessageHandler.OnInvalidMessage( + this, QueueMessage.ToQueueMessage(dequeuedMessageItem, QueueMessageEncoding.None), cancellationToken); } @@ -2360,12 +2362,14 @@ private async Task ToPeekedMessagesWithInvalidMessageHandling( if (async) { await _invalidQueueMessageHandler.OnInvalidMessageAsync( + this, PeekedMessage.ToPeekedMessage(peekedMessageItem, QueueMessageEncoding.None), cancellationToken).ConfigureAwait(false); } else { _invalidQueueMessageHandler.OnInvalidMessage( + this, PeekedMessage.ToPeekedMessage(peekedMessageItem, QueueMessageEncoding.None), cancellationToken); } diff --git a/sdk/storage/Azure.Storage.Queues/tests/QueueClientTests.cs b/sdk/storage/Azure.Storage.Queues/tests/QueueClientTests.cs index 69a4c03608ac4..bb388d467678b 100644 --- a/sdk/storage/Azure.Storage.Queues/tests/QueueClientTests.cs +++ b/sdk/storage/Azure.Storage.Queues/tests/QueueClientTests.cs @@ -797,12 +797,12 @@ public async Task CanHandleInvalidPeekedMessageAndReturnValid() if (IsAsync) { invalidQueueMessageHandlerMock.Verify( - m => m.OnInvalidMessageAsync(It.Is(m => ((PeekedMessage)m).Body.ToString() == nonEncodedContent), It.IsAny())); + m => m.OnInvalidMessageAsync(It.IsAny(), It.Is(m => ((PeekedMessage)m).Body.ToString() == nonEncodedContent), It.IsAny())); } else { invalidQueueMessageHandlerMock.Verify( - m => m.OnInvalidMessage(It.Is(m => ((PeekedMessage)m).Body.ToString() == nonEncodedContent), It.IsAny())); + m => m.OnInvalidMessage(It.IsAny(), It.Is(m => ((PeekedMessage)m).Body.ToString() == nonEncodedContent), It.IsAny())); } } @@ -866,12 +866,12 @@ public async Task CanHandleInvalidMessageAndReturnValid() if (IsAsync) { invalidQueueMessageHandlerMock.Verify( - m => m.OnInvalidMessageAsync(It.Is(m => ((QueueMessage)m).Body.ToString() == nonEncodedContent), It.IsAny())); + m => m.OnInvalidMessageAsync(It.IsAny(), It.Is(m => ((QueueMessage)m).Body.ToString() == nonEncodedContent), It.IsAny())); } else { invalidQueueMessageHandlerMock.Verify( - m => m.OnInvalidMessage(It.Is(m => ((QueueMessage)m).Body.ToString() == nonEncodedContent), It.IsAny())); + m => m.OnInvalidMessage(It.IsAny(), It.Is(m => ((QueueMessage)m).Body.ToString() == nonEncodedContent), It.IsAny())); } } From e489930f1aee2e7682c9ce18b9ef006dc0669feb Mon Sep 17 00:00:00 2001 From: Kamil Sobol Date: Thu, 7 Jan 2021 10:10:59 -0800 Subject: [PATCH 08/27] fire and forget callback. --- .../src/ClientTestBase.cs | 3 +- .../tests/Shared/StorageTestBase.cs | 22 ++++++ .../Azure.Storage.Queues.netstandard2.0.cs | 11 +-- .../src/InvalidQueueMessageEventArgs.cs | 42 +++++++++++ .../src/InvalidQueueMessageHandler.cs | 30 -------- .../Azure.Storage.Queues/src/QueueClient.cs | 71 +++++++------------ .../src/QueueClientOptions.cs | 7 +- .../src/QueueServiceClient.cs | 8 +-- .../tests/QueueClientTests.cs | 51 ++++++------- .../tests/QueueTestBase.cs | 17 +++-- 10 files changed, 137 insertions(+), 125 deletions(-) create mode 100644 sdk/storage/Azure.Storage.Queues/src/InvalidQueueMessageEventArgs.cs delete mode 100644 sdk/storage/Azure.Storage.Queues/src/InvalidQueueMessageHandler.cs diff --git a/sdk/core/Azure.Core.TestFramework/src/ClientTestBase.cs b/sdk/core/Azure.Core.TestFramework/src/ClientTestBase.cs index 7115ceba24f40..d2256e01a0837 100644 --- a/sdk/core/Azure.Core.TestFramework/src/ClientTestBase.cs +++ b/sdk/core/Azure.Core.TestFramework/src/ClientTestBase.cs @@ -52,7 +52,8 @@ internal object InstrumentClient(Type clientType, object client, IEnumerable predicate, int tries = 5, TimeSpan delay = default) + { + if (delay == default) + { + delay = TimeSpan.FromSeconds(2); + } + + for (int i = 0; i < tries; i++) + { + if (predicate()) + { + return; + } + else + { + await Task.Delay(delay); + } + } + + throw new Exception("Condition not reached"); + } + protected void AssertSecondaryStorageFirstRetrySuccessful(string primaryHost, string secondaryHost, TestExceptionPolicy testExceptionPolicy) { Assert.AreEqual(primaryHost, testExceptionPolicy.HostsSetInRequests[0]); diff --git a/sdk/storage/Azure.Storage.Queues/api/Azure.Storage.Queues.netstandard2.0.cs b/sdk/storage/Azure.Storage.Queues/api/Azure.Storage.Queues.netstandard2.0.cs index 742754368e52a..7b8eb0ccffcd8 100644 --- a/sdk/storage/Azure.Storage.Queues/api/Azure.Storage.Queues.netstandard2.0.cs +++ b/sdk/storage/Azure.Storage.Queues/api/Azure.Storage.Queues.netstandard2.0.cs @@ -1,10 +1,11 @@ namespace Azure.Storage.Queues { - public abstract partial class InvalidQueueMessageHandler + public partial class InvalidQueueMessageEventArgs : System.EventArgs { - protected InvalidQueueMessageHandler() { } - public abstract void OnInvalidMessage(Azure.Storage.Queues.QueueClient queueClient, object rawMessage, System.Threading.CancellationToken cancellationToken); - public abstract System.Threading.Tasks.Task OnInvalidMessageAsync(Azure.Storage.Queues.QueueClient queueClient, object rawMessage, System.Threading.CancellationToken cancellationToken); + public InvalidQueueMessageEventArgs(Azure.Storage.Queues.QueueClient sender, object message, System.Threading.CancellationToken cancellationToken) { } + public System.Threading.CancellationToken CancellationToken { get { throw null; } } + public object Message { get { throw null; } } + public Azure.Storage.Queues.QueueClient Sender { get { throw null; } } } public partial class QueueClient { @@ -21,6 +22,7 @@ public QueueClient(System.Uri queueUri, Azure.Storage.StorageSharedKeyCredential protected virtual System.Uri MessagesUri { get { throw null; } } public virtual string Name { get { throw null; } } public virtual System.Uri Uri { get { throw null; } } + public event System.Func InvalidQueueMessageAsync { add { } remove { } } public virtual Azure.Response ClearMessages(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task ClearMessagesAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Response Create(System.Collections.Generic.IDictionary metadata = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } @@ -75,7 +77,6 @@ public partial class QueueClientOptions : Azure.Core.ClientOptions { public QueueClientOptions(Azure.Storage.Queues.QueueClientOptions.ServiceVersion version = Azure.Storage.Queues.QueueClientOptions.ServiceVersion.V2020_04_08) { } public System.Uri GeoRedundantSecondaryUri { get { throw null; } set { } } - public Azure.Storage.Queues.InvalidQueueMessageHandler InvalidQueueMessageHandler { get { throw null; } set { } } public Azure.Storage.Queues.QueueMessageEncoding MessageEncoding { get { throw null; } set { } } public Azure.Storage.Queues.QueueClientOptions.ServiceVersion Version { get { throw null; } } public enum ServiceVersion diff --git a/sdk/storage/Azure.Storage.Queues/src/InvalidQueueMessageEventArgs.cs b/sdk/storage/Azure.Storage.Queues/src/InvalidQueueMessageEventArgs.cs new file mode 100644 index 0000000000000..aed23c7b210af --- /dev/null +++ b/sdk/storage/Azure.Storage.Queues/src/InvalidQueueMessageEventArgs.cs @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System; +using System.Threading; + +namespace Azure.Storage.Queues +{ + /// + /// TODO (kasobol-msft). + /// + public class InvalidQueueMessageEventArgs : EventArgs + { + /// + /// TODO (kasobol-msft). + /// + public QueueClient Sender { get; } + + /// + /// TODO (kasobol-msft). + /// + public object Message { get; } + + /// + /// TODO (kasobol-msft). + /// + public CancellationToken CancellationToken { get; } + + /// + /// TODO (kasobol-msft). + /// + /// + /// + /// + public InvalidQueueMessageEventArgs(QueueClient sender, object message, CancellationToken cancellationToken) + { + Sender = sender; + Message = message; + CancellationToken = cancellationToken; + } + } +} diff --git a/sdk/storage/Azure.Storage.Queues/src/InvalidQueueMessageHandler.cs b/sdk/storage/Azure.Storage.Queues/src/InvalidQueueMessageHandler.cs deleted file mode 100644 index b710af212e990..0000000000000 --- a/sdk/storage/Azure.Storage.Queues/src/InvalidQueueMessageHandler.cs +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -using System.Threading; -using System.Threading.Tasks; - -namespace Azure.Storage.Queues -{ - /// - /// TODO (kasobol-msft) add doc. - /// - public abstract class InvalidQueueMessageHandler - { - /// - /// TODO (kasobol-msft) add doc. - /// - /// - /// - /// - public abstract void OnInvalidMessage(QueueClient queueClient, object rawMessage, CancellationToken cancellationToken); - - /// - /// TODO (kasobol-msft) add doc. - /// - /// - /// - /// - public abstract Task OnInvalidMessageAsync(QueueClient queueClient, object rawMessage, CancellationToken cancellationToken); - } -} diff --git a/sdk/storage/Azure.Storage.Queues/src/QueueClient.cs b/sdk/storage/Azure.Storage.Queues/src/QueueClient.cs index 817510d33b986..f9cf1d9e39484 100644 --- a/sdk/storage/Azure.Storage.Queues/src/QueueClient.cs +++ b/sdk/storage/Azure.Storage.Queues/src/QueueClient.cs @@ -3,7 +3,6 @@ using System; using System.Collections.Generic; -using System.ComponentModel; using System.Globalization; using System.Linq; using System.Threading; @@ -126,9 +125,18 @@ public virtual string AccountName internal virtual QueueMessageEncoding MessageEncoding => _messageEncoding; - private InvalidQueueMessageHandler _invalidQueueMessageHandler; - - internal virtual InvalidQueueMessageHandler InvalidQueueMessageHandler => _invalidQueueMessageHandler; + /// + /// TODO (kasobol-msft) add doc. + /// +#pragma warning disable AZC0002 // DO ensure all service methods, both asynchronous and synchronous, take an optional CancellationToken parameter called cancellationToken. +#pragma warning disable AZC0003 // DO make service methods virtual. +#pragma warning disable AZC0004 // DO provide both asynchronous and synchronous variants for all service methods. +#pragma warning disable AZC0015 // Unexpected client method return type. + public event Func InvalidQueueMessageAsync; +#pragma warning restore AZC0015 // Unexpected client method return type. +#pragma warning restore AZC0004 // DO provide both asynchronous and synchronous variants for all service methods. +#pragma warning restore AZC0003 // DO make service methods virtual. +#pragma warning restore AZC0002 // DO ensure all service methods, both asynchronous and synchronous, take an optional CancellationToken parameter called cancellationToken. /// /// Gets the name of the queue. @@ -225,7 +233,6 @@ public QueueClient(string connectionString, string queueName, QueueClientOptions _clientSideEncryption = QueueClientSideEncryptionOptions.CloneFrom(options._clientSideEncryptionOptions); _storageSharedKeyCredential = conn.Credentials as StorageSharedKeyCredential; _messageEncoding = options.MessageEncoding; - _invalidQueueMessageHandler = options.InvalidQueueMessageHandler; AssertEncodingForEncryption(); } @@ -328,7 +335,6 @@ internal QueueClient( _clientSideEncryption = QueueClientSideEncryptionOptions.CloneFrom(options._clientSideEncryptionOptions); _storageSharedKeyCredential = storageSharedKeyCredential; _messageEncoding = options.MessageEncoding; - _invalidQueueMessageHandler = options.InvalidQueueMessageHandler; AssertEncodingForEncryption(); } @@ -360,9 +366,6 @@ internal QueueClient( /// /// The encoding of the message sent over the wire. /// - /// - /// TODO (kasobol-msft) add doc. - /// internal QueueClient( Uri queueUri, HttpPipeline pipeline, @@ -370,8 +373,7 @@ internal QueueClient( QueueClientOptions.ServiceVersion version, ClientDiagnostics clientDiagnostics, ClientSideEncryptionOptions encryptionOptions, - QueueMessageEncoding messageEncoding, - InvalidQueueMessageHandler invalidQueueMessageHandler) + QueueMessageEncoding messageEncoding) { _uri = queueUri; _messagesUri = queueUri.AppendToPath(Constants.Queue.MessagesUri); @@ -381,7 +383,6 @@ internal QueueClient( _clientDiagnostics = clientDiagnostics; _clientSideEncryption = QueueClientSideEncryptionOptions.CloneFrom(encryptionOptions); _messageEncoding = messageEncoding; - _invalidQueueMessageHandler = invalidQueueMessageHandler; AssertEncodingForEncryption(); } #endregion ctors @@ -414,8 +415,7 @@ protected internal virtual QueueClient WithClientSideEncryptionOptionsCore(Clien Version, ClientDiagnostics, clientSideEncryptionOptions, - MessageEncoding, - InvalidQueueMessageHandler); + MessageEncoding); } #region Create @@ -2052,9 +2052,9 @@ private async Task> ReceiveMessagesInternal( } else { QueueMessage[] queueMessages; - if (_invalidQueueMessageHandler != null) + if (InvalidQueueMessageAsync != null) { - queueMessages = await ToQueueMessagesWithInvalidMessageHandling(response.Value, async, cancellationToken).ConfigureAwait(false); + queueMessages = ToQueueMessagesWithInvalidMessageHandling(response.Value, cancellationToken); } else { queueMessages = response.Value.Select(x => QueueMessage.ToQueueMessage(x, _messageEncoding)).ToArray(); @@ -2087,9 +2087,8 @@ private async Task> ReceiveMessagesInternal( } } - private async Task ToQueueMessagesWithInvalidMessageHandling( + private QueueMessage[] ToQueueMessagesWithInvalidMessageHandling( IEnumerable dequeuedMessageItems, - bool async, CancellationToken cancellationToken) { List queueMessages = new List(); @@ -2102,19 +2101,11 @@ private async Task ToQueueMessagesWithInvalidMessageHandling( } catch (FormatException) { - if (async) - { - await _invalidQueueMessageHandler.OnInvalidMessageAsync( + _ = Task.Run(() => InvalidQueueMessageAsync.Invoke( + new InvalidQueueMessageEventArgs( this, QueueMessage.ToQueueMessage(dequeuedMessageItem, QueueMessageEncoding.None), - cancellationToken).ConfigureAwait(false); - } else - { - _invalidQueueMessageHandler.OnInvalidMessage( - this, - QueueMessage.ToQueueMessage(dequeuedMessageItem, QueueMessageEncoding.None), - cancellationToken); - } + cancellationToken)), cancellationToken); } } @@ -2394,9 +2385,9 @@ private async Task> PeekMessagesInternal( else { PeekedMessage[] peekedMessages; - if (_invalidQueueMessageHandler != null) + if (InvalidQueueMessageAsync != null) { - peekedMessages = await ToPeekedMessagesWithInvalidMessageHandling(response.Value, async, cancellationToken).ConfigureAwait(false); + peekedMessages = ToPeekedMessagesWithInvalidMessageHandling(response.Value, cancellationToken); } else { @@ -2430,9 +2421,8 @@ private async Task> PeekMessagesInternal( } } - private async Task ToPeekedMessagesWithInvalidMessageHandling( + private PeekedMessage[] ToPeekedMessagesWithInvalidMessageHandling( IEnumerable peekedMessageItems, - bool async, CancellationToken cancellationToken) { List peekedMessages = new List(); @@ -2445,20 +2435,11 @@ private async Task ToPeekedMessagesWithInvalidMessageHandling( } catch (FormatException) { - if (async) - { - await _invalidQueueMessageHandler.OnInvalidMessageAsync( - this, - PeekedMessage.ToPeekedMessage(peekedMessageItem, QueueMessageEncoding.None), - cancellationToken).ConfigureAwait(false); - } - else - { - _invalidQueueMessageHandler.OnInvalidMessage( + _ = Task.Run(() => InvalidQueueMessageAsync.Invoke( + new InvalidQueueMessageEventArgs( this, PeekedMessage.ToPeekedMessage(peekedMessageItem, QueueMessageEncoding.None), - cancellationToken); - } + cancellationToken)), cancellationToken); } } diff --git a/sdk/storage/Azure.Storage.Queues/src/QueueClientOptions.cs b/sdk/storage/Azure.Storage.Queues/src/QueueClientOptions.cs index 5a3dd35dccba8..0279f9c58770a 100644 --- a/sdk/storage/Azure.Storage.Queues/src/QueueClientOptions.cs +++ b/sdk/storage/Azure.Storage.Queues/src/QueueClientOptions.cs @@ -2,10 +2,10 @@ // Licensed under the MIT License. using System; +using System.Threading.Tasks; using Azure.Core; using Azure.Core.Pipeline; using Azure.Storage.Queues.Models; -using Azure.Storage.Queues.Specialized; namespace Azure.Storage.Queues { @@ -113,11 +113,6 @@ public QueueClientOptions(ServiceVersion version = LatestVersion) /// public QueueMessageEncoding MessageEncoding { get; set; } = QueueMessageEncoding.None; - /// - /// TODO (kasobol-msft) add doc. - /// - public InvalidQueueMessageHandler InvalidQueueMessageHandler { get; set; } - #region Advanced Options internal ClientSideEncryptionOptions _clientSideEncryptionOptions; #endregion diff --git a/sdk/storage/Azure.Storage.Queues/src/QueueServiceClient.cs b/sdk/storage/Azure.Storage.Queues/src/QueueServiceClient.cs index 9202420678a75..931078b9042c8 100644 --- a/sdk/storage/Azure.Storage.Queues/src/QueueServiceClient.cs +++ b/sdk/storage/Azure.Storage.Queues/src/QueueServiceClient.cs @@ -76,10 +76,6 @@ public class QueueServiceClient internal virtual QueueMessageEncoding MessageEncoding => _messageEncoding; - private readonly InvalidQueueMessageHandler _invalidQueueMessageHandler; - - internal virtual InvalidQueueMessageHandler InvalidQueueMessageHandler => _invalidQueueMessageHandler; - /// /// The Storage account name corresponding to the service client. /// @@ -172,7 +168,6 @@ public QueueServiceClient(string connectionString, QueueClientOptions options) _clientSideEncryption = QueueClientSideEncryptionOptions.CloneFrom(options._clientSideEncryptionOptions); _storageSharedKeyCredential = conn.Credentials as StorageSharedKeyCredential; _messageEncoding = options.MessageEncoding; - _invalidQueueMessageHandler = options.InvalidQueueMessageHandler; } /// @@ -269,7 +264,6 @@ internal QueueServiceClient( _clientSideEncryption = QueueClientSideEncryptionOptions.CloneFrom(options._clientSideEncryptionOptions); _storageSharedKeyCredential = storageSharedKeyCredential; _messageEncoding = options.MessageEncoding; - _invalidQueueMessageHandler = options.InvalidQueueMessageHandler; } #endregion ctors @@ -286,7 +280,7 @@ internal QueueServiceClient( /// A for the desired queue. /// public virtual QueueClient GetQueueClient(string queueName) - => new QueueClient(Uri.AppendToPath(queueName), Pipeline, SharedKeyCredential, Version, ClientDiagnostics, ClientSideEncryption, MessageEncoding, InvalidQueueMessageHandler); + => new QueueClient(Uri.AppendToPath(queueName), Pipeline, SharedKeyCredential, Version, ClientDiagnostics, ClientSideEncryption, MessageEncoding); #region GetQueues /// diff --git a/sdk/storage/Azure.Storage.Queues/tests/QueueClientTests.cs b/sdk/storage/Azure.Storage.Queues/tests/QueueClientTests.cs index f47b059685e91..69caff015a0ab 100644 --- a/sdk/storage/Azure.Storage.Queues/tests/QueueClientTests.cs +++ b/sdk/storage/Azure.Storage.Queues/tests/QueueClientTests.cs @@ -780,9 +780,16 @@ await TestHelper.AssertExpectedExceptionAsync( public async Task CanHandleInvalidPeekedMessageAndReturnValid() { // Arrange - Mock invalidQueueMessageHandlerMock = new Mock(); await using DisposingQueue test = await GetTestQueueAsync(); - var encodingClient = GetEncodingClient(test.Queue.Name, QueueMessageEncoding.Base64, invalidQueueMessageHandlerMock.Object); + object badMessage = null; + var encodingClient = GetEncodingClient( + test.Queue.Name, + QueueMessageEncoding.Base64, + arg => + { + badMessage = arg.Message; + return Task.CompletedTask; + }); var nonEncodedContent = "test_content"; await test.Queue.SendMessageAsync(nonEncodedContent); @@ -793,16 +800,13 @@ public async Task CanHandleInvalidPeekedMessageAndReturnValid() // Assert Assert.AreEqual(1, peekedMessages.Count()); - if (IsAsync) - { - invalidQueueMessageHandlerMock.Verify( - m => m.OnInvalidMessageAsync(It.IsAny(), It.Is(m => ((PeekedMessage)m).Body.ToString() == nonEncodedContent), It.IsAny())); - } - else - { - invalidQueueMessageHandlerMock.Verify( - m => m.OnInvalidMessage(It.IsAny(), It.Is(m => ((PeekedMessage)m).Body.ToString() == nonEncodedContent), It.IsAny())); - } + await WaitForCondition(() => badMessage != null); + Assert.AreEqual(nonEncodedContent, ((PeekedMessage)badMessage).Body.ToString()); + } + + private Task EncodingClient_InvalidQueueMessageAsync(InvalidQueueMessageEventArgs arg) + { + throw new NotImplementedException(); } [Test] @@ -849,9 +853,16 @@ await TestHelper.AssertExpectedExceptionAsync( public async Task CanHandleInvalidMessageAndReturnValid() { // Arrange - Mock invalidQueueMessageHandlerMock = new Mock(); await using DisposingQueue test = await GetTestQueueAsync(); - var encodingClient = GetEncodingClient(test.Queue.Name, QueueMessageEncoding.Base64, invalidQueueMessageHandlerMock.Object); + object badMessage = null; + var encodingClient = GetEncodingClient( + test.Queue.Name, + QueueMessageEncoding.Base64, + arg => + { + badMessage = arg.Message; + return Task.CompletedTask; + }); var nonEncodedContent = "test_content"; await test.Queue.SendMessageAsync(nonEncodedContent); @@ -862,16 +873,8 @@ public async Task CanHandleInvalidMessageAndReturnValid() // Assert Assert.AreEqual(1, queueMessages.Count()); - if (IsAsync) - { - invalidQueueMessageHandlerMock.Verify( - m => m.OnInvalidMessageAsync(It.IsAny(), It.Is(m => ((QueueMessage)m).Body.ToString() == nonEncodedContent), It.IsAny())); - } - else - { - invalidQueueMessageHandlerMock.Verify( - m => m.OnInvalidMessage(It.IsAny(), It.Is(m => ((QueueMessage)m).Body.ToString() == nonEncodedContent), It.IsAny())); - } + await WaitForCondition(() => badMessage != null); + Assert.AreEqual(nonEncodedContent, ((QueueMessage)badMessage).Body.ToString()); } [Test] diff --git a/sdk/storage/Azure.Storage.Queues/tests/QueueTestBase.cs b/sdk/storage/Azure.Storage.Queues/tests/QueueTestBase.cs index c1075ac1e9e2b..d123aaa9441ce 100644 --- a/sdk/storage/Azure.Storage.Queues/tests/QueueTestBase.cs +++ b/sdk/storage/Azure.Storage.Queues/tests/QueueTestBase.cs @@ -56,13 +56,15 @@ public QueueClientOptions GetOptions() } public QueueServiceClient GetServiceClient_SharedKey(QueueClientOptions options = default) - => InstrumentClient( - new QueueServiceClient( + => InstrumentClient(GetServiceClient_SharedKey_UnInstrumented(options)); + + private QueueServiceClient GetServiceClient_SharedKey_UnInstrumented(QueueClientOptions options = default) + => new QueueServiceClient( new Uri(TestConfigDefault.QueueServiceEndpoint), new StorageSharedKeyCredential( TestConfigDefault.AccountName, TestConfigDefault.AccountKey), - options ?? GetOptions())); + options ?? GetOptions()); public QueueServiceClient GetServiceClient_AccountSas(StorageSharedKeyCredential sharedKeyCredentials = default, SasQueryParameters sasCredentials = default) => InstrumentClient( @@ -154,13 +156,14 @@ public async Task GetTestQueueAsync( public QueueClient GetEncodingClient( string queueName, QueueMessageEncoding encoding, - InvalidQueueMessageHandler invalidQueueMessageHandler = default) + Func invalidMessageHandler = default) { var options = GetOptions(); options.MessageEncoding = encoding; - options.InvalidQueueMessageHandler = invalidQueueMessageHandler; - var service = GetServiceClient_SharedKey(options); - return InstrumentClient(service.GetQueueClient(queueName)); + var service = GetServiceClient_SharedKey_UnInstrumented(options); + var queueClient = service.GetQueueClient(queueName); + queueClient.InvalidQueueMessageAsync += invalidMessageHandler; + return InstrumentClient(queueClient); } public StorageSharedKeyCredential GetNewSharedKeyCredentials() From 415e4fd920b76b3f1a8a7f12fd18ec5be661232d Mon Sep 17 00:00:00 2001 From: Kamil Sobol Date: Thu, 7 Jan 2021 10:58:37 -0800 Subject: [PATCH 09/27] tweaks. --- .../Azure.Storage.Queues.netstandard2.0.cs | 3 +- .../src/InvalidQueueMessageEventArgs.cs | 34 ++++++++++++++----- .../Azure.Storage.Queues/src/QueueClient.cs | 12 ++++++- 3 files changed, 38 insertions(+), 11 deletions(-) diff --git a/sdk/storage/Azure.Storage.Queues/api/Azure.Storage.Queues.netstandard2.0.cs b/sdk/storage/Azure.Storage.Queues/api/Azure.Storage.Queues.netstandard2.0.cs index 7b8eb0ccffcd8..7d77815223156 100644 --- a/sdk/storage/Azure.Storage.Queues/api/Azure.Storage.Queues.netstandard2.0.cs +++ b/sdk/storage/Azure.Storage.Queues/api/Azure.Storage.Queues.netstandard2.0.cs @@ -2,7 +2,8 @@ namespace Azure.Storage.Queues { public partial class InvalidQueueMessageEventArgs : System.EventArgs { - public InvalidQueueMessageEventArgs(Azure.Storage.Queues.QueueClient sender, object message, System.Threading.CancellationToken cancellationToken) { } + public InvalidQueueMessageEventArgs(Azure.Storage.Queues.QueueClient sender, Azure.Storage.Queues.Models.PeekedMessage message, System.Threading.CancellationToken cancellationToken) { } + public InvalidQueueMessageEventArgs(Azure.Storage.Queues.QueueClient sender, Azure.Storage.Queues.Models.QueueMessage message, System.Threading.CancellationToken cancellationToken) { } public System.Threading.CancellationToken CancellationToken { get { throw null; } } public object Message { get { throw null; } } public Azure.Storage.Queues.QueueClient Sender { get { throw null; } } diff --git a/sdk/storage/Azure.Storage.Queues/src/InvalidQueueMessageEventArgs.cs b/sdk/storage/Azure.Storage.Queues/src/InvalidQueueMessageEventArgs.cs index aed23c7b210af..3a15afe117354 100644 --- a/sdk/storage/Azure.Storage.Queues/src/InvalidQueueMessageEventArgs.cs +++ b/sdk/storage/Azure.Storage.Queues/src/InvalidQueueMessageEventArgs.cs @@ -3,36 +3,52 @@ using System; using System.Threading; +using Azure.Storage.Queues.Models; namespace Azure.Storage.Queues { /// - /// TODO (kasobol-msft). + /// Contains information about invalid message. + /// See also . /// public class InvalidQueueMessageEventArgs : EventArgs { /// - /// TODO (kasobol-msft). + /// Gets the that has received invalid message. /// public QueueClient Sender { get; } /// - /// TODO (kasobol-msft). + /// Gets the invalid message which can be either or . + /// The body of the message is as received, i.e. no decoding is attempted. /// public object Message { get; } /// - /// TODO (kasobol-msft). + /// A instance to signal the request to cancel the operation. /// public CancellationToken CancellationToken { get; } /// - /// TODO (kasobol-msft). + /// Initializes a new instance of the . /// - /// - /// - /// - public InvalidQueueMessageEventArgs(QueueClient sender, object message, CancellationToken cancellationToken) + /// The that has received invalid message. + /// The invalid message + /// A instance to signal the request to cancel the operation. + public InvalidQueueMessageEventArgs(QueueClient sender, QueueMessage message, CancellationToken cancellationToken) + { + Sender = sender; + Message = message; + CancellationToken = cancellationToken; + } + + /// + /// Initializes a new instance of the . + /// + /// The that has received invalid message. + /// The invalid message + /// A instance to signal the request to cancel the operation. + public InvalidQueueMessageEventArgs(QueueClient sender, PeekedMessage message, CancellationToken cancellationToken) { Sender = sender; Message = message; diff --git a/sdk/storage/Azure.Storage.Queues/src/QueueClient.cs b/sdk/storage/Azure.Storage.Queues/src/QueueClient.cs index f9cf1d9e39484..aabdec1c8b37c 100644 --- a/sdk/storage/Azure.Storage.Queues/src/QueueClient.cs +++ b/sdk/storage/Azure.Storage.Queues/src/QueueClient.cs @@ -126,7 +126,17 @@ public virtual string AccountName internal virtual QueueMessageEncoding MessageEncoding => _messageEncoding; /// - /// TODO (kasobol-msft) add doc. + /// Optional. Performs the tasks needed when an invalid message is received or peaked from the queue. + /// + /// Invalid message can be received or peaked when is expecting certain + /// but there's another producer that is not encoding messages in expected way. I.e. the queue contains messages with different encoding. + /// + /// contains that has received invalid message as well as the message + /// which can be either or with raw body, i.e. no decoding will be attempted so that + /// body can be inspected as has been received from the queue. + /// + /// The won't attempt to remove invalid message from the queue. Therefore such handling should be included into + /// the event handler itself. /// #pragma warning disable AZC0002 // DO ensure all service methods, both asynchronous and synchronous, take an optional CancellationToken parameter called cancellationToken. #pragma warning disable AZC0003 // DO make service methods virtual. From 87c5c9e58f2c0cc3a3ca9061d14a450609b07245 Mon Sep 17 00:00:00 2001 From: Kamil Sobol Date: Tue, 26 Jan 2021 10:29:32 -0800 Subject: [PATCH 10/27] re-record. --- ...CanHandleInvalidMessageAndReturnValid.json | 91 ++++++++++--------- ...ndleInvalidMessageAndReturnValidAsync.json | 91 ++++++++++--------- ...dleInvalidPeekedMessageAndReturnValid.json | 91 ++++++++++--------- ...validPeekedMessageAndReturnValidAsync.json | 91 ++++++++++--------- ...lidPeekedMessageIfNoHandlerIsProvided.json | 70 +++++++------- ...ekedMessageIfNoHandlerIsProvidedAsync.json | 70 +++++++------- ...alidQueueMessageIfNoHandlerIsProvided.json | 70 +++++++------- ...ueueMessageIfNoHandlerIsProvidedAsync.json | 70 +++++++------- 8 files changed, 340 insertions(+), 304 deletions(-) diff --git a/sdk/storage/Azure.Storage.Queues/tests/SessionRecords/QueueClientTests/CanHandleInvalidMessageAndReturnValid.json b/sdk/storage/Azure.Storage.Queues/tests/SessionRecords/QueueClientTests/CanHandleInvalidMessageAndReturnValid.json index 9a32985b6d975..33c1ff218d6a4 100644 --- a/sdk/storage/Azure.Storage.Queues/tests/SessionRecords/QueueClientTests/CanHandleInvalidMessageAndReturnValid.json +++ b/sdk/storage/Azure.Storage.Queues/tests/SessionRecords/QueueClientTests/CanHandleInvalidMessageAndReturnValid.json @@ -1,17 +1,18 @@ { "Entries": [ { - "RequestUri": "http://kasoboltest.queue.core.windows.net/test-queue-d7128aab-de8f-566b-a7c9-68026a4e2ed9", + "RequestUri": "https://kasoboltest.queue.core.windows.net/test-queue-d7128aab-de8f-566b-a7c9-68026a4e2ed9", "RequestMethod": "PUT", "RequestHeaders": { + "Accept": "application/xml", "Authorization": "Sanitized", - "traceparent": "00-df0ca682fc8a1846ae25b7a3dca9cc93-11e094a071ab5f45-00", + "traceparent": "00-fdbf6b9910bde34c9410611d7b2ffd17-0972d4f58211dc42-00", "User-Agent": [ - "azsdk-net-Storage.Queues/12.6.0-alpha.20201116.1", - "(.NET Core 4.6.29321.03; Microsoft Windows 10.0.19042 )" + "azsdk-net-Storage.Queues/12.7.0-alpha.20210126.1", + "(.NET Framework 4.8.4250.0; Microsoft Windows 10.0.19042 )" ], "x-ms-client-request-id": "5d1d7b1f-3964-d68f-d16e-1d5964704bf2", - "x-ms-date": "Mon, 16 Nov 2020 22:31:45 GMT", + "x-ms-date": "Tue, 26 Jan 2021 18:28:18 GMT", "x-ms-return-client-request-id": "true", "x-ms-version": "2018-11-09" }, @@ -19,92 +20,95 @@ "StatusCode": 201, "ResponseHeaders": { "Content-Length": "0", - "Date": "Mon, 16 Nov 2020 22:31:46 GMT", + "Date": "Tue, 26 Jan 2021 18:28:18 GMT", "Server": [ "Windows-Azure-Queue/1.0", "Microsoft-HTTPAPI/2.0" ], - "x-ms-request-id": "2e014042-9003-002f-4268-bcd5c9000000", + "x-ms-request-id": "b763692a-a003-004a-2611-f46494000000", "x-ms-version": "2018-11-09" }, "ResponseBody": [] }, { - "RequestUri": "http://kasoboltest.queue.core.windows.net/test-queue-d7128aab-de8f-566b-a7c9-68026a4e2ed9/messages", + "RequestUri": "https://kasoboltest.queue.core.windows.net/test-queue-d7128aab-de8f-566b-a7c9-68026a4e2ed9/messages", "RequestMethod": "POST", "RequestHeaders": { + "Accept": "application/xml", "Authorization": "Sanitized", - "Content-Length": "68", + "Content-Length": "71", "Content-Type": "application/xml", - "traceparent": "00-a8c305b3bb97704089b047c3204af20f-79f2ec1f24d7c347-00", + "traceparent": "00-fea1c28c3cff2641b679b1415e586d88-15bc216bb641834a-00", "User-Agent": [ - "azsdk-net-Storage.Queues/12.6.0-alpha.20201116.1", - "(.NET Core 4.6.29321.03; Microsoft Windows 10.0.19042 )" + "azsdk-net-Storage.Queues/12.7.0-alpha.20210126.1", + "(.NET Framework 4.8.4250.0; Microsoft Windows 10.0.19042 )" ], "x-ms-client-request-id": "eee34d93-d130-d074-14b5-10b861cf877c", - "x-ms-date": "Mon, 16 Nov 2020 22:31:46 GMT", + "x-ms-date": "Tue, 26 Jan 2021 18:28:18 GMT", "x-ms-return-client-request-id": "true", "x-ms-version": "2018-11-09" }, - "RequestBody": "\u003CQueueMessage\u003E\u003CMessageText\u003Etest_content\u003C/MessageText\u003E\u003C/QueueMessage\u003E", + "RequestBody": "\uFEFF\u003CQueueMessage\u003E\u003CMessageText\u003Etest_content\u003C/MessageText\u003E\u003C/QueueMessage\u003E", "StatusCode": 201, "ResponseHeaders": { "Content-Type": "application/xml", - "Date": "Mon, 16 Nov 2020 22:31:46 GMT", + "Date": "Tue, 26 Jan 2021 18:28:18 GMT", "Server": [ "Windows-Azure-Queue/1.0", "Microsoft-HTTPAPI/2.0" ], "Transfer-Encoding": "chunked", - "x-ms-request-id": "2e01404b-9003-002f-4968-bcd5c9000000", + "x-ms-request-id": "b7636969-a003-004a-6211-f46494000000", "x-ms-version": "2018-11-09" }, - "ResponseBody": "\uFEFF\u003C?xml version=\u00221.0\u0022 encoding=\u0022utf-8\u0022?\u003E\u003CQueueMessagesList\u003E\u003CQueueMessage\u003E\u003CMessageId\u003Eeb8f3c02-bbbf-4cf9-af60-c8bf8395df33\u003C/MessageId\u003E\u003CInsertionTime\u003EMon, 16 Nov 2020 22:31:46 GMT\u003C/InsertionTime\u003E\u003CExpirationTime\u003EMon, 23 Nov 2020 22:31:46 GMT\u003C/ExpirationTime\u003E\u003CPopReceipt\u003EAgAAAAMAAAAAAAAA2043RGi81gE=\u003C/PopReceipt\u003E\u003CTimeNextVisible\u003EMon, 16 Nov 2020 22:31:46 GMT\u003C/TimeNextVisible\u003E\u003C/QueueMessage\u003E\u003C/QueueMessagesList\u003E" + "ResponseBody": "\uFEFF\u003C?xml version=\u00221.0\u0022 encoding=\u0022utf-8\u0022?\u003E\u003CQueueMessagesList\u003E\u003CQueueMessage\u003E\u003CMessageId\u003E1ff1a2be-1a76-444e-bc0c-1fe05c504955\u003C/MessageId\u003E\u003CInsertionTime\u003ETue, 26 Jan 2021 18:28:18 GMT\u003C/InsertionTime\u003E\u003CExpirationTime\u003ETue, 02 Feb 2021 18:28:18 GMT\u003C/ExpirationTime\u003E\u003CPopReceipt\u003EAgAAAAMAAAAAAAAApAztBBH01gE=\u003C/PopReceipt\u003E\u003CTimeNextVisible\u003ETue, 26 Jan 2021 18:28:18 GMT\u003C/TimeNextVisible\u003E\u003C/QueueMessage\u003E\u003C/QueueMessagesList\u003E" }, { - "RequestUri": "http://kasoboltest.queue.core.windows.net/test-queue-d7128aab-de8f-566b-a7c9-68026a4e2ed9/messages", + "RequestUri": "https://kasoboltest.queue.core.windows.net/test-queue-d7128aab-de8f-566b-a7c9-68026a4e2ed9/messages", "RequestMethod": "POST", "RequestHeaders": { + "Accept": "application/xml", "Authorization": "Sanitized", - "Content-Length": "72", + "Content-Length": "75", "Content-Type": "application/xml", - "traceparent": "00-cae920b501c41f4ba0d09b3535467cc8-86d82b24dea2bd4e-00", + "traceparent": "00-c17d3027a3e9ca4a8643e6e249c61ed8-16fd2784a5dd0941-00", "User-Agent": [ - "azsdk-net-Storage.Queues/12.6.0-alpha.20201116.1", - "(.NET Core 4.6.29321.03; Microsoft Windows 10.0.19042 )" + "azsdk-net-Storage.Queues/12.7.0-alpha.20210126.1", + "(.NET Framework 4.8.4250.0; Microsoft Windows 10.0.19042 )" ], "x-ms-client-request-id": "17c5ae04-5d8d-2ec2-b7bb-9c5ea7ffcb91", - "x-ms-date": "Mon, 16 Nov 2020 22:31:46 GMT", + "x-ms-date": "Tue, 26 Jan 2021 18:28:18 GMT", "x-ms-return-client-request-id": "true", "x-ms-version": "2018-11-09" }, - "RequestBody": "\u003CQueueMessage\u003E\u003CMessageText\u003EdGVzdF9jb250ZW50\u003C/MessageText\u003E\u003C/QueueMessage\u003E", + "RequestBody": "\uFEFF\u003CQueueMessage\u003E\u003CMessageText\u003EdGVzdF9jb250ZW50\u003C/MessageText\u003E\u003C/QueueMessage\u003E", "StatusCode": 201, "ResponseHeaders": { "Content-Type": "application/xml", - "Date": "Mon, 16 Nov 2020 22:31:45 GMT", + "Date": "Tue, 26 Jan 2021 18:28:18 GMT", "Server": [ "Windows-Azure-Queue/1.0", "Microsoft-HTTPAPI/2.0" ], "Transfer-Encoding": "chunked", - "x-ms-request-id": "ca363b92-a003-0005-3868-bca08c000000", + "x-ms-request-id": "8e0127fe-5003-001b-3111-f47a61000000", "x-ms-version": "2018-11-09" }, - "ResponseBody": "\uFEFF\u003C?xml version=\u00221.0\u0022 encoding=\u0022utf-8\u0022?\u003E\u003CQueueMessagesList\u003E\u003CQueueMessage\u003E\u003CMessageId\u003E8ffbc868-61ff-44c4-b32c-cafc7b6ac992\u003C/MessageId\u003E\u003CInsertionTime\u003EMon, 16 Nov 2020 22:31:46 GMT\u003C/InsertionTime\u003E\u003CExpirationTime\u003EMon, 23 Nov 2020 22:31:46 GMT\u003C/ExpirationTime\u003E\u003CPopReceipt\u003EAgAAAAMAAAAAAAAAqhRBRGi81gE=\u003C/PopReceipt\u003E\u003CTimeNextVisible\u003EMon, 16 Nov 2020 22:31:46 GMT\u003C/TimeNextVisible\u003E\u003C/QueueMessage\u003E\u003C/QueueMessagesList\u003E" + "ResponseBody": "\uFEFF\u003C?xml version=\u00221.0\u0022 encoding=\u0022utf-8\u0022?\u003E\u003CQueueMessagesList\u003E\u003CQueueMessage\u003E\u003CMessageId\u003E2d41fbdd-97c2-4314-b5a3-f11846f51423\u003C/MessageId\u003E\u003CInsertionTime\u003ETue, 26 Jan 2021 18:28:18 GMT\u003C/InsertionTime\u003E\u003CExpirationTime\u003ETue, 02 Feb 2021 18:28:18 GMT\u003C/ExpirationTime\u003E\u003CPopReceipt\u003EAgAAAAMAAAAAAAAASG0CBRH01gE=\u003C/PopReceipt\u003E\u003CTimeNextVisible\u003ETue, 26 Jan 2021 18:28:18 GMT\u003C/TimeNextVisible\u003E\u003C/QueueMessage\u003E\u003C/QueueMessagesList\u003E" }, { - "RequestUri": "http://kasoboltest.queue.core.windows.net/test-queue-d7128aab-de8f-566b-a7c9-68026a4e2ed9/messages?numofmessages=10", + "RequestUri": "https://kasoboltest.queue.core.windows.net/test-queue-d7128aab-de8f-566b-a7c9-68026a4e2ed9/messages?numofmessages=10", "RequestMethod": "GET", "RequestHeaders": { + "Accept": "application/xml", "Authorization": "Sanitized", - "traceparent": "00-0adec9dc58f05047860cbefd0f3504db-92d642e5dbd9f049-00", + "traceparent": "00-15c98c8b1eb310439afe3df82da5060f-398cf0394a014247-00", "User-Agent": [ - "azsdk-net-Storage.Queues/12.6.0-alpha.20201116.1", - "(.NET Core 4.6.29321.03; Microsoft Windows 10.0.19042 )" + "azsdk-net-Storage.Queues/12.7.0-alpha.20210126.1", + "(.NET Framework 4.8.4250.0; Microsoft Windows 10.0.19042 )" ], "x-ms-client-request-id": "b2b31eac-7009-4aef-5b5e-08f1e7a9bec3", - "x-ms-date": "Mon, 16 Nov 2020 22:31:46 GMT", + "x-ms-date": "Tue, 26 Jan 2021 18:28:19 GMT", "x-ms-return-client-request-id": "true", "x-ms-version": "2018-11-09" }, @@ -113,30 +117,31 @@ "ResponseHeaders": { "Cache-Control": "no-cache", "Content-Type": "application/xml", - "Date": "Mon, 16 Nov 2020 22:31:45 GMT", + "Date": "Tue, 26 Jan 2021 18:28:18 GMT", "Server": [ "Windows-Azure-Queue/1.0", "Microsoft-HTTPAPI/2.0" ], "Transfer-Encoding": "chunked", "Vary": "Origin", - "x-ms-request-id": "ca363b99-a003-0005-3d68-bca08c000000", + "x-ms-request-id": "8e012825-5003-001b-5311-f47a61000000", "x-ms-version": "2018-11-09" }, - "ResponseBody": "\uFEFF\u003C?xml version=\u00221.0\u0022 encoding=\u0022utf-8\u0022?\u003E\u003CQueueMessagesList\u003E\u003CQueueMessage\u003E\u003CMessageId\u003Eeb8f3c02-bbbf-4cf9-af60-c8bf8395df33\u003C/MessageId\u003E\u003CInsertionTime\u003EMon, 16 Nov 2020 22:31:46 GMT\u003C/InsertionTime\u003E\u003CExpirationTime\u003EMon, 23 Nov 2020 22:31:46 GMT\u003C/ExpirationTime\u003E\u003CPopReceipt\u003EAgAAAAMAAAAAAAAAYKgqVmi81gE=\u003C/PopReceipt\u003E\u003CTimeNextVisible\u003EMon, 16 Nov 2020 22:32:16 GMT\u003C/TimeNextVisible\u003E\u003CDequeueCount\u003E1\u003C/DequeueCount\u003E\u003CMessageText\u003Etest_content\u003C/MessageText\u003E\u003C/QueueMessage\u003E\u003CQueueMessage\u003E\u003CMessageId\u003E8ffbc868-61ff-44c4-b32c-cafc7b6ac992\u003C/MessageId\u003E\u003CInsertionTime\u003EMon, 16 Nov 2020 22:31:46 GMT\u003C/InsertionTime\u003E\u003CExpirationTime\u003EMon, 23 Nov 2020 22:31:46 GMT\u003C/ExpirationTime\u003E\u003CPopReceipt\u003EAgAAAAMAAAAAAAAAYKgqVmi81gE=\u003C/PopReceipt\u003E\u003CTimeNextVisible\u003EMon, 16 Nov 2020 22:32:16 GMT\u003C/TimeNextVisible\u003E\u003CDequeueCount\u003E1\u003C/DequeueCount\u003E\u003CMessageText\u003EdGVzdF9jb250ZW50\u003C/MessageText\u003E\u003C/QueueMessage\u003E\u003C/QueueMessagesList\u003E" + "ResponseBody": "\uFEFF\u003C?xml version=\u00221.0\u0022 encoding=\u0022utf-8\u0022?\u003E\u003CQueueMessagesList\u003E\u003CQueueMessage\u003E\u003CMessageId\u003E1ff1a2be-1a76-444e-bc0c-1fe05c504955\u003C/MessageId\u003E\u003CInsertionTime\u003ETue, 26 Jan 2021 18:28:18 GMT\u003C/InsertionTime\u003E\u003CExpirationTime\u003ETue, 02 Feb 2021 18:28:18 GMT\u003C/ExpirationTime\u003E\u003CPopReceipt\u003EAgAAAAMAAAAAAAAA/svoFhH01gE=\u003C/PopReceipt\u003E\u003CTimeNextVisible\u003ETue, 26 Jan 2021 18:28:48 GMT\u003C/TimeNextVisible\u003E\u003CDequeueCount\u003E1\u003C/DequeueCount\u003E\u003CMessageText\u003Etest_content\u003C/MessageText\u003E\u003C/QueueMessage\u003E\u003CQueueMessage\u003E\u003CMessageId\u003E2d41fbdd-97c2-4314-b5a3-f11846f51423\u003C/MessageId\u003E\u003CInsertionTime\u003ETue, 26 Jan 2021 18:28:18 GMT\u003C/InsertionTime\u003E\u003CExpirationTime\u003ETue, 02 Feb 2021 18:28:18 GMT\u003C/ExpirationTime\u003E\u003CPopReceipt\u003EAgAAAAMAAAAAAAAA/svoFhH01gE=\u003C/PopReceipt\u003E\u003CTimeNextVisible\u003ETue, 26 Jan 2021 18:28:48 GMT\u003C/TimeNextVisible\u003E\u003CDequeueCount\u003E1\u003C/DequeueCount\u003E\u003CMessageText\u003EdGVzdF9jb250ZW50\u003C/MessageText\u003E\u003C/QueueMessage\u003E\u003C/QueueMessagesList\u003E" }, { - "RequestUri": "http://kasoboltest.queue.core.windows.net/test-queue-d7128aab-de8f-566b-a7c9-68026a4e2ed9", + "RequestUri": "https://kasoboltest.queue.core.windows.net/test-queue-d7128aab-de8f-566b-a7c9-68026a4e2ed9", "RequestMethod": "DELETE", "RequestHeaders": { + "Accept": "application/xml", "Authorization": "Sanitized", - "traceparent": "00-51aee3e259bc9245b4c5fa62f9f6a555-0df9fdbc8de8794c-00", + "traceparent": "00-66f340217874f44e9c1599974140dcef-4ac6f5ebed221848-00", "User-Agent": [ - "azsdk-net-Storage.Queues/12.6.0-alpha.20201116.1", - "(.NET Core 4.6.29321.03; Microsoft Windows 10.0.19042 )" + "azsdk-net-Storage.Queues/12.7.0-alpha.20210126.1", + "(.NET Framework 4.8.4250.0; Microsoft Windows 10.0.19042 )" ], "x-ms-client-request-id": "89b17b3a-194b-2e87-7da9-54f3a0cf289c", - "x-ms-date": "Mon, 16 Nov 2020 22:31:46 GMT", + "x-ms-date": "Tue, 26 Jan 2021 18:28:19 GMT", "x-ms-return-client-request-id": "true", "x-ms-version": "2018-11-09" }, @@ -144,12 +149,12 @@ "StatusCode": 204, "ResponseHeaders": { "Content-Length": "0", - "Date": "Mon, 16 Nov 2020 22:31:46 GMT", + "Date": "Tue, 26 Jan 2021 18:28:18 GMT", "Server": [ "Windows-Azure-Queue/1.0", "Microsoft-HTTPAPI/2.0" ], - "x-ms-request-id": "2e014057-9003-002f-5468-bcd5c9000000", + "x-ms-request-id": "b76369cd-a003-004a-4411-f46494000000", "x-ms-version": "2018-11-09" }, "ResponseBody": [] @@ -157,6 +162,6 @@ ], "Variables": { "RandomSeed": "1486437419", - "Storage_TestConfigDefault": "ProductionTenant\nkasoboltest\nU2FuaXRpemVk\nhttp://kasoboltest.blob.core.windows.net\nhttp://kasoboltest.file.core.windows.net\nhttp://kasoboltest.queue.core.windows.net\nhttp://kasoboltest.table.core.windows.net\n\n\n\n\nhttp://kasoboltest-secondary.blob.core.windows.net\nhttp://kasoboltest-secondary.file.core.windows.net\nhttp://kasoboltest-secondary.queue.core.windows.net\nhttp://kasoboltest-secondary.table.core.windows.net\n\nSanitized\n\n\nCloud\nBlobEndpoint=http://kasoboltest.blob.core.windows.net/;QueueEndpoint=http://kasoboltest.queue.core.windows.net/;FileEndpoint=http://kasoboltest.file.core.windows.net/;BlobSecondaryEndpoint=http://kasoboltest-secondary.blob.core.windows.net/;QueueSecondaryEndpoint=http://kasoboltest-secondary.queue.core.windows.net/;FileSecondaryEndpoint=http://kasoboltest-secondary.file.core.windows.net/;AccountName=kasoboltest;AccountKey=Kg==;\nencryptionScope" + "Storage_TestConfigDefault": "ProductionTenant\nkasoboltest\nU2FuaXRpemVk\nhttps://kasoboltest.blob.core.windows.net\nhttps://kasoboltest.file.core.windows.net\nhttps://kasoboltest.queue.core.windows.net\nhttps://kasoboltest.table.core.windows.net\n\n\n\n\nhttps://kasoboltest-secondary.blob.core.windows.net\nhttps://kasoboltest-secondary.file.core.windows.net\nhttps://kasoboltest-secondary.queue.core.windows.net\nhttps://kasoboltest-secondary.table.core.windows.net\n\nSanitized\n\n\nCloud\nBlobEndpoint=https://kasoboltest.blob.core.windows.net/;QueueEndpoint=https://kasoboltest.queue.core.windows.net/;FileEndpoint=https://kasoboltest.file.core.windows.net/;BlobSecondaryEndpoint=https://kasoboltest-secondary.blob.core.windows.net/;QueueSecondaryEndpoint=https://kasoboltest-secondary.queue.core.windows.net/;FileSecondaryEndpoint=https://kasoboltest-secondary.file.core.windows.net/;AccountName=kasoboltest;AccountKey=Kg==;\nencryptionScope" } } \ No newline at end of file diff --git a/sdk/storage/Azure.Storage.Queues/tests/SessionRecords/QueueClientTests/CanHandleInvalidMessageAndReturnValidAsync.json b/sdk/storage/Azure.Storage.Queues/tests/SessionRecords/QueueClientTests/CanHandleInvalidMessageAndReturnValidAsync.json index 79b03e5529269..f4894ba25235b 100644 --- a/sdk/storage/Azure.Storage.Queues/tests/SessionRecords/QueueClientTests/CanHandleInvalidMessageAndReturnValidAsync.json +++ b/sdk/storage/Azure.Storage.Queues/tests/SessionRecords/QueueClientTests/CanHandleInvalidMessageAndReturnValidAsync.json @@ -1,17 +1,18 @@ { "Entries": [ { - "RequestUri": "http://kasoboltest.queue.core.windows.net/test-queue-c5683fc2-f70b-440a-29ee-3d7d009be19e", + "RequestUri": "https://kasoboltest.queue.core.windows.net/test-queue-c5683fc2-f70b-440a-29ee-3d7d009be19e", "RequestMethod": "PUT", "RequestHeaders": { + "Accept": "application/xml", "Authorization": "Sanitized", - "traceparent": "00-74025cf8d478f14bad74c29f231882a1-fcd6bf17c74b8d41-00", + "traceparent": "00-81c7794ffd0b434b8f956ad65d68fc52-9d79d58148a70d46-00", "User-Agent": [ - "azsdk-net-Storage.Queues/12.6.0-alpha.20201116.1", - "(.NET Core 4.6.29321.03; Microsoft Windows 10.0.19042 )" + "azsdk-net-Storage.Queues/12.7.0-alpha.20210126.1", + "(.NET Framework 4.8.4250.0; Microsoft Windows 10.0.19042 )" ], "x-ms-client-request-id": "14f54917-8966-c9a4-4e04-df6c43ff8841", - "x-ms-date": "Mon, 16 Nov 2020 22:31:46 GMT", + "x-ms-date": "Tue, 26 Jan 2021 18:28:19 GMT", "x-ms-return-client-request-id": "true", "x-ms-version": "2018-11-09" }, @@ -19,92 +20,95 @@ "StatusCode": 201, "ResponseHeaders": { "Content-Length": "0", - "Date": "Mon, 16 Nov 2020 22:31:45 GMT", + "Date": "Tue, 26 Jan 2021 18:28:19 GMT", "Server": [ "Windows-Azure-Queue/1.0", "Microsoft-HTTPAPI/2.0" ], - "x-ms-request-id": "d73ce5be-f003-003f-6d68-bce32f000000", + "x-ms-request-id": "26c48710-2003-0014-4711-f49797000000", "x-ms-version": "2018-11-09" }, "ResponseBody": [] }, { - "RequestUri": "http://kasoboltest.queue.core.windows.net/test-queue-c5683fc2-f70b-440a-29ee-3d7d009be19e/messages", + "RequestUri": "https://kasoboltest.queue.core.windows.net/test-queue-c5683fc2-f70b-440a-29ee-3d7d009be19e/messages", "RequestMethod": "POST", "RequestHeaders": { + "Accept": "application/xml", "Authorization": "Sanitized", - "Content-Length": "68", + "Content-Length": "71", "Content-Type": "application/xml", - "traceparent": "00-05ad8e8c7496a74cbaf46f5b1777e86c-deca65c6bad4fd4b-00", + "traceparent": "00-ec738d713b5a45418ee3f058b8c3b444-d8e5dd4135096c4c-00", "User-Agent": [ - "azsdk-net-Storage.Queues/12.6.0-alpha.20201116.1", - "(.NET Core 4.6.29321.03; Microsoft Windows 10.0.19042 )" + "azsdk-net-Storage.Queues/12.7.0-alpha.20210126.1", + "(.NET Framework 4.8.4250.0; Microsoft Windows 10.0.19042 )" ], "x-ms-client-request-id": "b6654d0f-cda5-1137-5552-8b4e87cf9472", - "x-ms-date": "Mon, 16 Nov 2020 22:31:46 GMT", + "x-ms-date": "Tue, 26 Jan 2021 18:28:19 GMT", "x-ms-return-client-request-id": "true", "x-ms-version": "2018-11-09" }, - "RequestBody": "\u003CQueueMessage\u003E\u003CMessageText\u003Etest_content\u003C/MessageText\u003E\u003C/QueueMessage\u003E", + "RequestBody": "\uFEFF\u003CQueueMessage\u003E\u003CMessageText\u003Etest_content\u003C/MessageText\u003E\u003C/QueueMessage\u003E", "StatusCode": 201, "ResponseHeaders": { "Content-Type": "application/xml", - "Date": "Mon, 16 Nov 2020 22:31:46 GMT", + "Date": "Tue, 26 Jan 2021 18:28:19 GMT", "Server": [ "Windows-Azure-Queue/1.0", "Microsoft-HTTPAPI/2.0" ], "Transfer-Encoding": "chunked", - "x-ms-request-id": "d73ce5d2-f003-003f-7d68-bce32f000000", + "x-ms-request-id": "26c48737-2003-0014-6b11-f49797000000", "x-ms-version": "2018-11-09" }, - "ResponseBody": "\uFEFF\u003C?xml version=\u00221.0\u0022 encoding=\u0022utf-8\u0022?\u003E\u003CQueueMessagesList\u003E\u003CQueueMessage\u003E\u003CMessageId\u003E356508b7-170f-439c-afc3-0f519046f5e1\u003C/MessageId\u003E\u003CInsertionTime\u003EMon, 16 Nov 2020 22:31:46 GMT\u003C/InsertionTime\u003E\u003CExpirationTime\u003EMon, 23 Nov 2020 22:31:46 GMT\u003C/ExpirationTime\u003E\u003CPopReceipt\u003EAgAAAAMAAAAAAAAAsiJ3RGi81gE=\u003C/PopReceipt\u003E\u003CTimeNextVisible\u003EMon, 16 Nov 2020 22:31:46 GMT\u003C/TimeNextVisible\u003E\u003C/QueueMessage\u003E\u003C/QueueMessagesList\u003E" + "ResponseBody": "\uFEFF\u003C?xml version=\u00221.0\u0022 encoding=\u0022utf-8\u0022?\u003E\u003CQueueMessagesList\u003E\u003CQueueMessage\u003E\u003CMessageId\u003Ee3110220-5d56-4269-838c-3e0e8d882f24\u003C/MessageId\u003E\u003CInsertionTime\u003ETue, 26 Jan 2021 18:28:19 GMT\u003C/InsertionTime\u003E\u003CExpirationTime\u003ETue, 02 Feb 2021 18:28:19 GMT\u003C/ExpirationTime\u003E\u003CPopReceipt\u003EAgAAAAMAAAAAAAAAh1JDBRH01gE=\u003C/PopReceipt\u003E\u003CTimeNextVisible\u003ETue, 26 Jan 2021 18:28:19 GMT\u003C/TimeNextVisible\u003E\u003C/QueueMessage\u003E\u003C/QueueMessagesList\u003E" }, { - "RequestUri": "http://kasoboltest.queue.core.windows.net/test-queue-c5683fc2-f70b-440a-29ee-3d7d009be19e/messages", + "RequestUri": "https://kasoboltest.queue.core.windows.net/test-queue-c5683fc2-f70b-440a-29ee-3d7d009be19e/messages", "RequestMethod": "POST", "RequestHeaders": { + "Accept": "application/xml", "Authorization": "Sanitized", - "Content-Length": "72", + "Content-Length": "75", "Content-Type": "application/xml", - "traceparent": "00-865516e1d4976646877b12ff7821955e-4be903b6d9336746-00", + "traceparent": "00-9bdf5040edd5074dbd8b32b7e9a61e0d-a42b8a26c243bf47-00", "User-Agent": [ - "azsdk-net-Storage.Queues/12.6.0-alpha.20201116.1", - "(.NET Core 4.6.29321.03; Microsoft Windows 10.0.19042 )" + "azsdk-net-Storage.Queues/12.7.0-alpha.20210126.1", + "(.NET Framework 4.8.4250.0; Microsoft Windows 10.0.19042 )" ], "x-ms-client-request-id": "f65ddba6-d199-889b-15db-8ae85a70d434", - "x-ms-date": "Mon, 16 Nov 2020 22:31:46 GMT", + "x-ms-date": "Tue, 26 Jan 2021 18:28:19 GMT", "x-ms-return-client-request-id": "true", "x-ms-version": "2018-11-09" }, - "RequestBody": "\u003CQueueMessage\u003E\u003CMessageText\u003EdGVzdF9jb250ZW50\u003C/MessageText\u003E\u003C/QueueMessage\u003E", + "RequestBody": "\uFEFF\u003CQueueMessage\u003E\u003CMessageText\u003EdGVzdF9jb250ZW50\u003C/MessageText\u003E\u003C/QueueMessage\u003E", "StatusCode": 201, "ResponseHeaders": { "Content-Type": "application/xml", - "Date": "Mon, 16 Nov 2020 22:31:46 GMT", + "Date": "Tue, 26 Jan 2021 18:28:18 GMT", "Server": [ "Windows-Azure-Queue/1.0", "Microsoft-HTTPAPI/2.0" ], "Transfer-Encoding": "chunked", - "x-ms-request-id": "4b3ecf2f-d003-0028-0268-bc234c000000", + "x-ms-request-id": "e5e6e40c-4003-0069-2a11-f40b5f000000", "x-ms-version": "2018-11-09" }, - "ResponseBody": "\uFEFF\u003C?xml version=\u00221.0\u0022 encoding=\u0022utf-8\u0022?\u003E\u003CQueueMessagesList\u003E\u003CQueueMessage\u003E\u003CMessageId\u003E47a03680-9c1e-47df-ade5-9de544de6ee7\u003C/MessageId\u003E\u003CInsertionTime\u003EMon, 16 Nov 2020 22:31:46 GMT\u003C/InsertionTime\u003E\u003CExpirationTime\u003EMon, 23 Nov 2020 22:31:46 GMT\u003C/ExpirationTime\u003E\u003CPopReceipt\u003EAgAAAAMAAAAAAAAAlw\u002BBRGi81gE=\u003C/PopReceipt\u003E\u003CTimeNextVisible\u003EMon, 16 Nov 2020 22:31:46 GMT\u003C/TimeNextVisible\u003E\u003C/QueueMessage\u003E\u003C/QueueMessagesList\u003E" + "ResponseBody": "\uFEFF\u003C?xml version=\u00221.0\u0022 encoding=\u0022utf-8\u0022?\u003E\u003CQueueMessagesList\u003E\u003CQueueMessage\u003E\u003CMessageId\u003E0d5f5ee0-8a46-4555-8ad1-9f032b0e9a39\u003C/MessageId\u003E\u003CInsertionTime\u003ETue, 26 Jan 2021 18:28:19 GMT\u003C/InsertionTime\u003E\u003CExpirationTime\u003ETue, 02 Feb 2021 18:28:19 GMT\u003C/ExpirationTime\u003E\u003CPopReceipt\u003EAgAAAAMAAAAAAAAARlNXBRH01gE=\u003C/PopReceipt\u003E\u003CTimeNextVisible\u003ETue, 26 Jan 2021 18:28:19 GMT\u003C/TimeNextVisible\u003E\u003C/QueueMessage\u003E\u003C/QueueMessagesList\u003E" }, { - "RequestUri": "http://kasoboltest.queue.core.windows.net/test-queue-c5683fc2-f70b-440a-29ee-3d7d009be19e/messages?numofmessages=10", + "RequestUri": "https://kasoboltest.queue.core.windows.net/test-queue-c5683fc2-f70b-440a-29ee-3d7d009be19e/messages?numofmessages=10", "RequestMethod": "GET", "RequestHeaders": { + "Accept": "application/xml", "Authorization": "Sanitized", - "traceparent": "00-f748a100c83bba428a683967eca7d8ef-fc348addb4ebda46-00", + "traceparent": "00-17cee9886cf8d649a1837befa3e004be-90c1617070df5f41-00", "User-Agent": [ - "azsdk-net-Storage.Queues/12.6.0-alpha.20201116.1", - "(.NET Core 4.6.29321.03; Microsoft Windows 10.0.19042 )" + "azsdk-net-Storage.Queues/12.7.0-alpha.20210126.1", + "(.NET Framework 4.8.4250.0; Microsoft Windows 10.0.19042 )" ], "x-ms-client-request-id": "aba85dbf-9d71-ffd9-e40c-845d75cdd81a", - "x-ms-date": "Mon, 16 Nov 2020 22:31:46 GMT", + "x-ms-date": "Tue, 26 Jan 2021 18:28:19 GMT", "x-ms-return-client-request-id": "true", "x-ms-version": "2018-11-09" }, @@ -113,30 +117,31 @@ "ResponseHeaders": { "Cache-Control": "no-cache", "Content-Type": "application/xml", - "Date": "Mon, 16 Nov 2020 22:31:46 GMT", + "Date": "Tue, 26 Jan 2021 18:28:18 GMT", "Server": [ "Windows-Azure-Queue/1.0", "Microsoft-HTTPAPI/2.0" ], "Transfer-Encoding": "chunked", "Vary": "Origin", - "x-ms-request-id": "4b3ecf43-d003-0028-1468-bc234c000000", + "x-ms-request-id": "e5e6e416-4003-0069-3211-f40b5f000000", "x-ms-version": "2018-11-09" }, - "ResponseBody": "\uFEFF\u003C?xml version=\u00221.0\u0022 encoding=\u0022utf-8\u0022?\u003E\u003CQueueMessagesList\u003E\u003CQueueMessage\u003E\u003CMessageId\u003E356508b7-170f-439c-afc3-0f519046f5e1\u003C/MessageId\u003E\u003CInsertionTime\u003EMon, 16 Nov 2020 22:31:46 GMT\u003C/InsertionTime\u003E\u003CExpirationTime\u003EMon, 23 Nov 2020 22:31:46 GMT\u003C/ExpirationTime\u003E\u003CPopReceipt\u003EAgAAAAMAAAAAAAAAeJVnVmi81gE=\u003C/PopReceipt\u003E\u003CTimeNextVisible\u003EMon, 16 Nov 2020 22:32:16 GMT\u003C/TimeNextVisible\u003E\u003CDequeueCount\u003E1\u003C/DequeueCount\u003E\u003CMessageText\u003Etest_content\u003C/MessageText\u003E\u003C/QueueMessage\u003E\u003CQueueMessage\u003E\u003CMessageId\u003E47a03680-9c1e-47df-ade5-9de544de6ee7\u003C/MessageId\u003E\u003CInsertionTime\u003EMon, 16 Nov 2020 22:31:46 GMT\u003C/InsertionTime\u003E\u003CExpirationTime\u003EMon, 23 Nov 2020 22:31:46 GMT\u003C/ExpirationTime\u003E\u003CPopReceipt\u003EAgAAAAMAAAAAAAAAeJVnVmi81gE=\u003C/PopReceipt\u003E\u003CTimeNextVisible\u003EMon, 16 Nov 2020 22:32:16 GMT\u003C/TimeNextVisible\u003E\u003CDequeueCount\u003E1\u003C/DequeueCount\u003E\u003CMessageText\u003EdGVzdF9jb250ZW50\u003C/MessageText\u003E\u003C/QueueMessage\u003E\u003C/QueueMessagesList\u003E" + "ResponseBody": "\uFEFF\u003C?xml version=\u00221.0\u0022 encoding=\u0022utf-8\u0022?\u003E\u003CQueueMessagesList\u003E\u003CQueueMessage\u003E\u003CMessageId\u003Ee3110220-5d56-4269-838c-3e0e8d882f24\u003C/MessageId\u003E\u003CInsertionTime\u003ETue, 26 Jan 2021 18:28:19 GMT\u003C/InsertionTime\u003E\u003CExpirationTime\u003ETue, 02 Feb 2021 18:28:19 GMT\u003C/ExpirationTime\u003E\u003CPopReceipt\u003EAgAAAAMAAAAAAAAANdk9FxH01gE=\u003C/PopReceipt\u003E\u003CTimeNextVisible\u003ETue, 26 Jan 2021 18:28:49 GMT\u003C/TimeNextVisible\u003E\u003CDequeueCount\u003E1\u003C/DequeueCount\u003E\u003CMessageText\u003Etest_content\u003C/MessageText\u003E\u003C/QueueMessage\u003E\u003CQueueMessage\u003E\u003CMessageId\u003E0d5f5ee0-8a46-4555-8ad1-9f032b0e9a39\u003C/MessageId\u003E\u003CInsertionTime\u003ETue, 26 Jan 2021 18:28:19 GMT\u003C/InsertionTime\u003E\u003CExpirationTime\u003ETue, 02 Feb 2021 18:28:19 GMT\u003C/ExpirationTime\u003E\u003CPopReceipt\u003EAgAAAAMAAAAAAAAANdk9FxH01gE=\u003C/PopReceipt\u003E\u003CTimeNextVisible\u003ETue, 26 Jan 2021 18:28:49 GMT\u003C/TimeNextVisible\u003E\u003CDequeueCount\u003E1\u003C/DequeueCount\u003E\u003CMessageText\u003EdGVzdF9jb250ZW50\u003C/MessageText\u003E\u003C/QueueMessage\u003E\u003C/QueueMessagesList\u003E" }, { - "RequestUri": "http://kasoboltest.queue.core.windows.net/test-queue-c5683fc2-f70b-440a-29ee-3d7d009be19e", + "RequestUri": "https://kasoboltest.queue.core.windows.net/test-queue-c5683fc2-f70b-440a-29ee-3d7d009be19e", "RequestMethod": "DELETE", "RequestHeaders": { + "Accept": "application/xml", "Authorization": "Sanitized", - "traceparent": "00-5ce75916f0c58c4a82aa499a361e8f69-3946eb722cdb5046-00", + "traceparent": "00-78deecccfcddbc4d97491313c51716e7-fc4e65e13775954c-00", "User-Agent": [ - "azsdk-net-Storage.Queues/12.6.0-alpha.20201116.1", - "(.NET Core 4.6.29321.03; Microsoft Windows 10.0.19042 )" + "azsdk-net-Storage.Queues/12.7.0-alpha.20210126.1", + "(.NET Framework 4.8.4250.0; Microsoft Windows 10.0.19042 )" ], "x-ms-client-request-id": "fc282600-28c7-5ec2-07e3-d180406d9aca", - "x-ms-date": "Mon, 16 Nov 2020 22:31:46 GMT", + "x-ms-date": "Tue, 26 Jan 2021 18:28:19 GMT", "x-ms-return-client-request-id": "true", "x-ms-version": "2018-11-09" }, @@ -144,12 +149,12 @@ "StatusCode": 204, "ResponseHeaders": { "Content-Length": "0", - "Date": "Mon, 16 Nov 2020 22:31:46 GMT", + "Date": "Tue, 26 Jan 2021 18:28:19 GMT", "Server": [ "Windows-Azure-Queue/1.0", "Microsoft-HTTPAPI/2.0" ], - "x-ms-request-id": "d73ce5e5-f003-003f-0e68-bce32f000000", + "x-ms-request-id": "26c48792-2003-0014-3f11-f49797000000", "x-ms-version": "2018-11-09" }, "ResponseBody": [] @@ -157,6 +162,6 @@ ], "Variables": { "RandomSeed": "1418509458", - "Storage_TestConfigDefault": "ProductionTenant\nkasoboltest\nU2FuaXRpemVk\nhttp://kasoboltest.blob.core.windows.net\nhttp://kasoboltest.file.core.windows.net\nhttp://kasoboltest.queue.core.windows.net\nhttp://kasoboltest.table.core.windows.net\n\n\n\n\nhttp://kasoboltest-secondary.blob.core.windows.net\nhttp://kasoboltest-secondary.file.core.windows.net\nhttp://kasoboltest-secondary.queue.core.windows.net\nhttp://kasoboltest-secondary.table.core.windows.net\n\nSanitized\n\n\nCloud\nBlobEndpoint=http://kasoboltest.blob.core.windows.net/;QueueEndpoint=http://kasoboltest.queue.core.windows.net/;FileEndpoint=http://kasoboltest.file.core.windows.net/;BlobSecondaryEndpoint=http://kasoboltest-secondary.blob.core.windows.net/;QueueSecondaryEndpoint=http://kasoboltest-secondary.queue.core.windows.net/;FileSecondaryEndpoint=http://kasoboltest-secondary.file.core.windows.net/;AccountName=kasoboltest;AccountKey=Kg==;\nencryptionScope" + "Storage_TestConfigDefault": "ProductionTenant\nkasoboltest\nU2FuaXRpemVk\nhttps://kasoboltest.blob.core.windows.net\nhttps://kasoboltest.file.core.windows.net\nhttps://kasoboltest.queue.core.windows.net\nhttps://kasoboltest.table.core.windows.net\n\n\n\n\nhttps://kasoboltest-secondary.blob.core.windows.net\nhttps://kasoboltest-secondary.file.core.windows.net\nhttps://kasoboltest-secondary.queue.core.windows.net\nhttps://kasoboltest-secondary.table.core.windows.net\n\nSanitized\n\n\nCloud\nBlobEndpoint=https://kasoboltest.blob.core.windows.net/;QueueEndpoint=https://kasoboltest.queue.core.windows.net/;FileEndpoint=https://kasoboltest.file.core.windows.net/;BlobSecondaryEndpoint=https://kasoboltest-secondary.blob.core.windows.net/;QueueSecondaryEndpoint=https://kasoboltest-secondary.queue.core.windows.net/;FileSecondaryEndpoint=https://kasoboltest-secondary.file.core.windows.net/;AccountName=kasoboltest;AccountKey=Kg==;\nencryptionScope" } } \ No newline at end of file diff --git a/sdk/storage/Azure.Storage.Queues/tests/SessionRecords/QueueClientTests/CanHandleInvalidPeekedMessageAndReturnValid.json b/sdk/storage/Azure.Storage.Queues/tests/SessionRecords/QueueClientTests/CanHandleInvalidPeekedMessageAndReturnValid.json index 60e9265519517..4555b56f9a6ae 100644 --- a/sdk/storage/Azure.Storage.Queues/tests/SessionRecords/QueueClientTests/CanHandleInvalidPeekedMessageAndReturnValid.json +++ b/sdk/storage/Azure.Storage.Queues/tests/SessionRecords/QueueClientTests/CanHandleInvalidPeekedMessageAndReturnValid.json @@ -1,17 +1,18 @@ { "Entries": [ { - "RequestUri": "http://kasoboltest.queue.core.windows.net/test-queue-23202ac5-0933-9847-100f-76a8c1575601", + "RequestUri": "https://kasoboltest.queue.core.windows.net/test-queue-23202ac5-0933-9847-100f-76a8c1575601", "RequestMethod": "PUT", "RequestHeaders": { + "Accept": "application/xml", "Authorization": "Sanitized", - "traceparent": "00-68480f05053a5b4b9e2e75b5c0e343aa-7209da994a9e2943-00", + "traceparent": "00-181ad08ed4ecc4429ac3eb0e9796d08c-c616bf7949875f4b-00", "User-Agent": [ - "azsdk-net-Storage.Queues/12.6.0-alpha.20201119.1", - "(.NET Core 4.6.29321.03; Microsoft Windows 10.0.19042 )" + "azsdk-net-Storage.Queues/12.7.0-alpha.20210126.1", + "(.NET Framework 4.8.4250.0; Microsoft Windows 10.0.19042 )" ], "x-ms-client-request-id": "73fe4bea-fb6b-d8ba-baf0-0708abce6a3c", - "x-ms-date": "Thu, 19 Nov 2020 17:00:03 GMT", + "x-ms-date": "Tue, 26 Jan 2021 18:28:42 GMT", "x-ms-return-client-request-id": "true", "x-ms-version": "2018-11-09" }, @@ -19,92 +20,95 @@ "StatusCode": 201, "ResponseHeaders": { "Content-Length": "0", - "Date": "Thu, 19 Nov 2020 17:00:03 GMT", + "Date": "Tue, 26 Jan 2021 18:28:43 GMT", "Server": [ "Windows-Azure-Queue/1.0", "Microsoft-HTTPAPI/2.0" ], - "x-ms-request-id": "9aef70e1-1003-001c-6995-be8ce4000000", + "x-ms-request-id": "aa802ad5-6003-005c-1f11-f4a50a000000", "x-ms-version": "2018-11-09" }, "ResponseBody": [] }, { - "RequestUri": "http://kasoboltest.queue.core.windows.net/test-queue-23202ac5-0933-9847-100f-76a8c1575601/messages", + "RequestUri": "https://kasoboltest.queue.core.windows.net/test-queue-23202ac5-0933-9847-100f-76a8c1575601/messages", "RequestMethod": "POST", "RequestHeaders": { + "Accept": "application/xml", "Authorization": "Sanitized", - "Content-Length": "68", + "Content-Length": "71", "Content-Type": "application/xml", - "traceparent": "00-77a4c544d56ada4a9b7d5097a3e11315-f8450828638d8049-00", + "traceparent": "00-10db29351f62414c875d14322a3b03eb-ec286cf4e8cb6745-00", "User-Agent": [ - "azsdk-net-Storage.Queues/12.6.0-alpha.20201119.1", - "(.NET Core 4.6.29321.03; Microsoft Windows 10.0.19042 )" + "azsdk-net-Storage.Queues/12.7.0-alpha.20210126.1", + "(.NET Framework 4.8.4250.0; Microsoft Windows 10.0.19042 )" ], "x-ms-client-request-id": "75bdf63f-e259-3e96-f5e4-9cb23eb19441", - "x-ms-date": "Thu, 19 Nov 2020 17:00:04 GMT", + "x-ms-date": "Tue, 26 Jan 2021 18:28:43 GMT", "x-ms-return-client-request-id": "true", "x-ms-version": "2018-11-09" }, - "RequestBody": "\u003CQueueMessage\u003E\u003CMessageText\u003Etest_content\u003C/MessageText\u003E\u003C/QueueMessage\u003E", + "RequestBody": "\uFEFF\u003CQueueMessage\u003E\u003CMessageText\u003Etest_content\u003C/MessageText\u003E\u003C/QueueMessage\u003E", "StatusCode": 201, "ResponseHeaders": { "Content-Type": "application/xml", - "Date": "Thu, 19 Nov 2020 17:00:03 GMT", + "Date": "Tue, 26 Jan 2021 18:28:43 GMT", "Server": [ "Windows-Azure-Queue/1.0", "Microsoft-HTTPAPI/2.0" ], "Transfer-Encoding": "chunked", - "x-ms-request-id": "9aef7128-1003-001c-2d95-be8ce4000000", + "x-ms-request-id": "aa802add-6003-005c-2511-f4a50a000000", "x-ms-version": "2018-11-09" }, - "ResponseBody": "\uFEFF\u003C?xml version=\u00221.0\u0022 encoding=\u0022utf-8\u0022?\u003E\u003CQueueMessagesList\u003E\u003CQueueMessage\u003E\u003CMessageId\u003Ea6b8d2e0-b02f-4279-a221-863036ce373c\u003C/MessageId\u003E\u003CInsertionTime\u003EThu, 19 Nov 2020 17:00:03 GMT\u003C/InsertionTime\u003E\u003CExpirationTime\u003EThu, 26 Nov 2020 17:00:03 GMT\u003C/ExpirationTime\u003E\u003CPopReceipt\u003EAgAAAAMAAAAAAAAAeOrQbJW\u002B1gE=\u003C/PopReceipt\u003E\u003CTimeNextVisible\u003EThu, 19 Nov 2020 17:00:03 GMT\u003C/TimeNextVisible\u003E\u003C/QueueMessage\u003E\u003C/QueueMessagesList\u003E" + "ResponseBody": "\uFEFF\u003C?xml version=\u00221.0\u0022 encoding=\u0022utf-8\u0022?\u003E\u003CQueueMessagesList\u003E\u003CQueueMessage\u003E\u003CMessageId\u003E23aa5ea5-377a-413c-bd58-551707d1e648\u003C/MessageId\u003E\u003CInsertionTime\u003ETue, 26 Jan 2021 18:28:43 GMT\u003C/InsertionTime\u003E\u003CExpirationTime\u003ETue, 02 Feb 2021 18:28:43 GMT\u003C/ExpirationTime\u003E\u003CPopReceipt\u003EAgAAAAMAAAAAAAAAjx\u002BGExH01gE=\u003C/PopReceipt\u003E\u003CTimeNextVisible\u003ETue, 26 Jan 2021 18:28:43 GMT\u003C/TimeNextVisible\u003E\u003C/QueueMessage\u003E\u003C/QueueMessagesList\u003E" }, { - "RequestUri": "http://kasoboltest.queue.core.windows.net/test-queue-23202ac5-0933-9847-100f-76a8c1575601/messages", + "RequestUri": "https://kasoboltest.queue.core.windows.net/test-queue-23202ac5-0933-9847-100f-76a8c1575601/messages", "RequestMethod": "POST", "RequestHeaders": { + "Accept": "application/xml", "Authorization": "Sanitized", - "Content-Length": "72", + "Content-Length": "75", "Content-Type": "application/xml", - "traceparent": "00-faf0b824fd1cdb4583e077ed85e26fc8-8339f81b013cd540-00", + "traceparent": "00-bf8e7fa1887e2f4ca8d30ad28aa695df-74d6124ab6f89248-00", "User-Agent": [ - "azsdk-net-Storage.Queues/12.6.0-alpha.20201119.1", - "(.NET Core 4.6.29321.03; Microsoft Windows 10.0.19042 )" + "azsdk-net-Storage.Queues/12.7.0-alpha.20210126.1", + "(.NET Framework 4.8.4250.0; Microsoft Windows 10.0.19042 )" ], "x-ms-client-request-id": "b5c9a575-f510-24e2-8f78-1523ee0240be", - "x-ms-date": "Thu, 19 Nov 2020 17:00:04 GMT", + "x-ms-date": "Tue, 26 Jan 2021 18:28:43 GMT", "x-ms-return-client-request-id": "true", "x-ms-version": "2018-11-09" }, - "RequestBody": "\u003CQueueMessage\u003E\u003CMessageText\u003EdGVzdF9jb250ZW50\u003C/MessageText\u003E\u003C/QueueMessage\u003E", + "RequestBody": "\uFEFF\u003CQueueMessage\u003E\u003CMessageText\u003EdGVzdF9jb250ZW50\u003C/MessageText\u003E\u003C/QueueMessage\u003E", "StatusCode": 201, "ResponseHeaders": { "Content-Type": "application/xml", - "Date": "Thu, 19 Nov 2020 17:00:03 GMT", + "Date": "Tue, 26 Jan 2021 18:28:43 GMT", "Server": [ "Windows-Azure-Queue/1.0", "Microsoft-HTTPAPI/2.0" ], "Transfer-Encoding": "chunked", - "x-ms-request-id": "e2669e54-a003-0063-6495-be12d6000000", + "x-ms-request-id": "edad456d-a003-0005-0b11-f4a08c000000", "x-ms-version": "2018-11-09" }, - "ResponseBody": "\uFEFF\u003C?xml version=\u00221.0\u0022 encoding=\u0022utf-8\u0022?\u003E\u003CQueueMessagesList\u003E\u003CQueueMessage\u003E\u003CMessageId\u003Ecb6367e2-c93d-4f7b-8343-79e38f4d9fa8\u003C/MessageId\u003E\u003CInsertionTime\u003EThu, 19 Nov 2020 17:00:03 GMT\u003C/InsertionTime\u003E\u003CExpirationTime\u003EThu, 26 Nov 2020 17:00:03 GMT\u003C/ExpirationTime\u003E\u003CPopReceipt\u003EAgAAAAMAAAAAAAAAH4nabJW\u002B1gE=\u003C/PopReceipt\u003E\u003CTimeNextVisible\u003EThu, 19 Nov 2020 17:00:03 GMT\u003C/TimeNextVisible\u003E\u003C/QueueMessage\u003E\u003C/QueueMessagesList\u003E" + "ResponseBody": "\uFEFF\u003C?xml version=\u00221.0\u0022 encoding=\u0022utf-8\u0022?\u003E\u003CQueueMessagesList\u003E\u003CQueueMessage\u003E\u003CMessageId\u003Eebc93a4b-5aca-446f-87f4-ec86192aa09d\u003C/MessageId\u003E\u003CInsertionTime\u003ETue, 26 Jan 2021 18:28:43 GMT\u003C/InsertionTime\u003E\u003CExpirationTime\u003ETue, 02 Feb 2021 18:28:43 GMT\u003C/ExpirationTime\u003E\u003CPopReceipt\u003EAgAAAAMAAAAAAAAAjxycExH01gE=\u003C/PopReceipt\u003E\u003CTimeNextVisible\u003ETue, 26 Jan 2021 18:28:43 GMT\u003C/TimeNextVisible\u003E\u003C/QueueMessage\u003E\u003C/QueueMessagesList\u003E" }, { - "RequestUri": "http://kasoboltest.queue.core.windows.net/test-queue-23202ac5-0933-9847-100f-76a8c1575601/messages?peekonly=true\u0026numofmessages=10", + "RequestUri": "https://kasoboltest.queue.core.windows.net/test-queue-23202ac5-0933-9847-100f-76a8c1575601/messages?peekonly=true\u0026numofmessages=10", "RequestMethod": "GET", "RequestHeaders": { + "Accept": "application/xml", "Authorization": "Sanitized", - "traceparent": "00-ce99ed13f2dcdf4ba680b2952e06d7ad-96c5b68544a2a64a-00", + "traceparent": "00-1eac97a6db94b24fa3888df1cac3848f-dec48e55c9b24244-00", "User-Agent": [ - "azsdk-net-Storage.Queues/12.6.0-alpha.20201119.1", - "(.NET Core 4.6.29321.03; Microsoft Windows 10.0.19042 )" + "azsdk-net-Storage.Queues/12.7.0-alpha.20210126.1", + "(.NET Framework 4.8.4250.0; Microsoft Windows 10.0.19042 )" ], "x-ms-client-request-id": "993dba69-dfe7-3731-8d43-6780ae557194", - "x-ms-date": "Thu, 19 Nov 2020 17:00:04 GMT", + "x-ms-date": "Tue, 26 Jan 2021 18:28:43 GMT", "x-ms-return-client-request-id": "true", "x-ms-version": "2018-11-09" }, @@ -113,30 +117,31 @@ "ResponseHeaders": { "Cache-Control": "no-cache", "Content-Type": "application/xml", - "Date": "Thu, 19 Nov 2020 17:00:03 GMT", + "Date": "Tue, 26 Jan 2021 18:28:43 GMT", "Server": [ "Windows-Azure-Queue/1.0", "Microsoft-HTTPAPI/2.0" ], "Transfer-Encoding": "chunked", "Vary": "Origin", - "x-ms-request-id": "e2669e59-a003-0063-6795-be12d6000000", + "x-ms-request-id": "edad45a8-a003-0005-4411-f4a08c000000", "x-ms-version": "2018-11-09" }, - "ResponseBody": "\uFEFF\u003C?xml version=\u00221.0\u0022 encoding=\u0022utf-8\u0022?\u003E\u003CQueueMessagesList\u003E\u003CQueueMessage\u003E\u003CMessageId\u003Ea6b8d2e0-b02f-4279-a221-863036ce373c\u003C/MessageId\u003E\u003CInsertionTime\u003EThu, 19 Nov 2020 17:00:03 GMT\u003C/InsertionTime\u003E\u003CExpirationTime\u003EThu, 26 Nov 2020 17:00:03 GMT\u003C/ExpirationTime\u003E\u003CDequeueCount\u003E0\u003C/DequeueCount\u003E\u003CMessageText\u003Etest_content\u003C/MessageText\u003E\u003C/QueueMessage\u003E\u003CQueueMessage\u003E\u003CMessageId\u003Ecb6367e2-c93d-4f7b-8343-79e38f4d9fa8\u003C/MessageId\u003E\u003CInsertionTime\u003EThu, 19 Nov 2020 17:00:03 GMT\u003C/InsertionTime\u003E\u003CExpirationTime\u003EThu, 26 Nov 2020 17:00:03 GMT\u003C/ExpirationTime\u003E\u003CDequeueCount\u003E0\u003C/DequeueCount\u003E\u003CMessageText\u003EdGVzdF9jb250ZW50\u003C/MessageText\u003E\u003C/QueueMessage\u003E\u003C/QueueMessagesList\u003E" + "ResponseBody": "\uFEFF\u003C?xml version=\u00221.0\u0022 encoding=\u0022utf-8\u0022?\u003E\u003CQueueMessagesList\u003E\u003CQueueMessage\u003E\u003CMessageId\u003E23aa5ea5-377a-413c-bd58-551707d1e648\u003C/MessageId\u003E\u003CInsertionTime\u003ETue, 26 Jan 2021 18:28:43 GMT\u003C/InsertionTime\u003E\u003CExpirationTime\u003ETue, 02 Feb 2021 18:28:43 GMT\u003C/ExpirationTime\u003E\u003CDequeueCount\u003E0\u003C/DequeueCount\u003E\u003CMessageText\u003Etest_content\u003C/MessageText\u003E\u003C/QueueMessage\u003E\u003CQueueMessage\u003E\u003CMessageId\u003Eebc93a4b-5aca-446f-87f4-ec86192aa09d\u003C/MessageId\u003E\u003CInsertionTime\u003ETue, 26 Jan 2021 18:28:43 GMT\u003C/InsertionTime\u003E\u003CExpirationTime\u003ETue, 02 Feb 2021 18:28:43 GMT\u003C/ExpirationTime\u003E\u003CDequeueCount\u003E0\u003C/DequeueCount\u003E\u003CMessageText\u003EdGVzdF9jb250ZW50\u003C/MessageText\u003E\u003C/QueueMessage\u003E\u003C/QueueMessagesList\u003E" }, { - "RequestUri": "http://kasoboltest.queue.core.windows.net/test-queue-23202ac5-0933-9847-100f-76a8c1575601", + "RequestUri": "https://kasoboltest.queue.core.windows.net/test-queue-23202ac5-0933-9847-100f-76a8c1575601", "RequestMethod": "DELETE", "RequestHeaders": { + "Accept": "application/xml", "Authorization": "Sanitized", - "traceparent": "00-a49cd366ea944b47b7f7b88d2908ebb6-c5aca86b03d94640-00", + "traceparent": "00-bb903f16d1b0054b89814d98fb947470-b4512436572e1546-00", "User-Agent": [ - "azsdk-net-Storage.Queues/12.6.0-alpha.20201119.1", - "(.NET Core 4.6.29321.03; Microsoft Windows 10.0.19042 )" + "azsdk-net-Storage.Queues/12.7.0-alpha.20210126.1", + "(.NET Framework 4.8.4250.0; Microsoft Windows 10.0.19042 )" ], "x-ms-client-request-id": "33ba3d21-a7c5-6cd7-a038-5e2d1ce7cb28", - "x-ms-date": "Thu, 19 Nov 2020 17:00:04 GMT", + "x-ms-date": "Tue, 26 Jan 2021 18:28:43 GMT", "x-ms-return-client-request-id": "true", "x-ms-version": "2018-11-09" }, @@ -144,12 +149,12 @@ "StatusCode": 204, "ResponseHeaders": { "Content-Length": "0", - "Date": "Thu, 19 Nov 2020 17:00:03 GMT", + "Date": "Tue, 26 Jan 2021 18:28:43 GMT", "Server": [ "Windows-Azure-Queue/1.0", "Microsoft-HTTPAPI/2.0" ], - "x-ms-request-id": "9aef71bd-1003-001c-3e95-be8ce4000000", + "x-ms-request-id": "aa802aec-6003-005c-3011-f4a50a000000", "x-ms-version": "2018-11-09" }, "ResponseBody": [] @@ -157,6 +162,6 @@ ], "Variables": { "RandomSeed": "201465153", - "Storage_TestConfigDefault": "ProductionTenant\nkasoboltest\nU2FuaXRpemVk\nhttp://kasoboltest.blob.core.windows.net\nhttp://kasoboltest.file.core.windows.net\nhttp://kasoboltest.queue.core.windows.net\nhttp://kasoboltest.table.core.windows.net\n\n\n\n\nhttp://kasoboltest-secondary.blob.core.windows.net\nhttp://kasoboltest-secondary.file.core.windows.net\nhttp://kasoboltest-secondary.queue.core.windows.net\nhttp://kasoboltest-secondary.table.core.windows.net\n\nSanitized\n\n\nCloud\nBlobEndpoint=http://kasoboltest.blob.core.windows.net/;QueueEndpoint=http://kasoboltest.queue.core.windows.net/;FileEndpoint=http://kasoboltest.file.core.windows.net/;BlobSecondaryEndpoint=http://kasoboltest-secondary.blob.core.windows.net/;QueueSecondaryEndpoint=http://kasoboltest-secondary.queue.core.windows.net/;FileSecondaryEndpoint=http://kasoboltest-secondary.file.core.windows.net/;AccountName=kasoboltest;AccountKey=Kg==;\nencryptionScope" + "Storage_TestConfigDefault": "ProductionTenant\nkasoboltest\nU2FuaXRpemVk\nhttps://kasoboltest.blob.core.windows.net\nhttps://kasoboltest.file.core.windows.net\nhttps://kasoboltest.queue.core.windows.net\nhttps://kasoboltest.table.core.windows.net\n\n\n\n\nhttps://kasoboltest-secondary.blob.core.windows.net\nhttps://kasoboltest-secondary.file.core.windows.net\nhttps://kasoboltest-secondary.queue.core.windows.net\nhttps://kasoboltest-secondary.table.core.windows.net\n\nSanitized\n\n\nCloud\nBlobEndpoint=https://kasoboltest.blob.core.windows.net/;QueueEndpoint=https://kasoboltest.queue.core.windows.net/;FileEndpoint=https://kasoboltest.file.core.windows.net/;BlobSecondaryEndpoint=https://kasoboltest-secondary.blob.core.windows.net/;QueueSecondaryEndpoint=https://kasoboltest-secondary.queue.core.windows.net/;FileSecondaryEndpoint=https://kasoboltest-secondary.file.core.windows.net/;AccountName=kasoboltest;AccountKey=Kg==;\nencryptionScope" } } \ No newline at end of file diff --git a/sdk/storage/Azure.Storage.Queues/tests/SessionRecords/QueueClientTests/CanHandleInvalidPeekedMessageAndReturnValidAsync.json b/sdk/storage/Azure.Storage.Queues/tests/SessionRecords/QueueClientTests/CanHandleInvalidPeekedMessageAndReturnValidAsync.json index d273f9153ed7b..ca72e5bce5d55 100644 --- a/sdk/storage/Azure.Storage.Queues/tests/SessionRecords/QueueClientTests/CanHandleInvalidPeekedMessageAndReturnValidAsync.json +++ b/sdk/storage/Azure.Storage.Queues/tests/SessionRecords/QueueClientTests/CanHandleInvalidPeekedMessageAndReturnValidAsync.json @@ -1,17 +1,18 @@ { "Entries": [ { - "RequestUri": "http://kasoboltest.queue.core.windows.net/test-queue-a0e452de-885f-cc3b-2ed6-639ca012364d", + "RequestUri": "https://kasoboltest.queue.core.windows.net/test-queue-a0e452de-885f-cc3b-2ed6-639ca012364d", "RequestMethod": "PUT", "RequestHeaders": { + "Accept": "application/xml", "Authorization": "Sanitized", - "traceparent": "00-c53ea523a7ab0649bfc57e0263145116-f6ae995e02741346-00", + "traceparent": "00-ceac11a18dda614ebd1f86723babd13a-5369c2aabce8314c-00", "User-Agent": [ - "azsdk-net-Storage.Queues/12.6.0-alpha.20201119.1", - "(.NET Core 4.6.29321.03; Microsoft Windows 10.0.19042 )" + "azsdk-net-Storage.Queues/12.7.0-alpha.20210126.1", + "(.NET Framework 4.8.4250.0; Microsoft Windows 10.0.19042 )" ], "x-ms-client-request-id": "e4febf01-7bdb-c0de-9aba-8c217ffb38ac", - "x-ms-date": "Thu, 19 Nov 2020 17:00:04 GMT", + "x-ms-date": "Tue, 26 Jan 2021 18:28:43 GMT", "x-ms-return-client-request-id": "true", "x-ms-version": "2018-11-09" }, @@ -19,92 +20,95 @@ "StatusCode": 201, "ResponseHeaders": { "Content-Length": "0", - "Date": "Thu, 19 Nov 2020 17:00:03 GMT", + "Date": "Tue, 26 Jan 2021 18:28:43 GMT", "Server": [ "Windows-Azure-Queue/1.0", "Microsoft-HTTPAPI/2.0" ], - "x-ms-request-id": "3db5c3ed-9003-0049-4495-be6793000000", + "x-ms-request-id": "99f5840c-4003-0062-1711-f4132b000000", "x-ms-version": "2018-11-09" }, "ResponseBody": [] }, { - "RequestUri": "http://kasoboltest.queue.core.windows.net/test-queue-a0e452de-885f-cc3b-2ed6-639ca012364d/messages", + "RequestUri": "https://kasoboltest.queue.core.windows.net/test-queue-a0e452de-885f-cc3b-2ed6-639ca012364d/messages", "RequestMethod": "POST", "RequestHeaders": { + "Accept": "application/xml", "Authorization": "Sanitized", - "Content-Length": "68", + "Content-Length": "71", "Content-Type": "application/xml", - "traceparent": "00-8ef2e5d66e616e45b528574787f76c06-daf814eab1a8fe49-00", + "traceparent": "00-9e51875c3e2ea0428194593c1ec15507-3305ecf8b23da349-00", "User-Agent": [ - "azsdk-net-Storage.Queues/12.6.0-alpha.20201119.1", - "(.NET Core 4.6.29321.03; Microsoft Windows 10.0.19042 )" + "azsdk-net-Storage.Queues/12.7.0-alpha.20210126.1", + "(.NET Framework 4.8.4250.0; Microsoft Windows 10.0.19042 )" ], "x-ms-client-request-id": "e19abb5b-5214-d072-e67b-f02ef73c0ec3", - "x-ms-date": "Thu, 19 Nov 2020 17:00:04 GMT", + "x-ms-date": "Tue, 26 Jan 2021 18:28:43 GMT", "x-ms-return-client-request-id": "true", "x-ms-version": "2018-11-09" }, - "RequestBody": "\u003CQueueMessage\u003E\u003CMessageText\u003Etest_content\u003C/MessageText\u003E\u003C/QueueMessage\u003E", + "RequestBody": "\uFEFF\u003CQueueMessage\u003E\u003CMessageText\u003Etest_content\u003C/MessageText\u003E\u003C/QueueMessage\u003E", "StatusCode": 201, "ResponseHeaders": { "Content-Type": "application/xml", - "Date": "Thu, 19 Nov 2020 17:00:03 GMT", + "Date": "Tue, 26 Jan 2021 18:28:43 GMT", "Server": [ "Windows-Azure-Queue/1.0", "Microsoft-HTTPAPI/2.0" ], "Transfer-Encoding": "chunked", - "x-ms-request-id": "3db5c401-9003-0049-5595-be6793000000", + "x-ms-request-id": "99f5841e-4003-0062-2511-f4132b000000", "x-ms-version": "2018-11-09" }, - "ResponseBody": "\uFEFF\u003C?xml version=\u00221.0\u0022 encoding=\u0022utf-8\u0022?\u003E\u003CQueueMessagesList\u003E\u003CQueueMessage\u003E\u003CMessageId\u003Ef30896b0-d340-4f3f-9215-17060e8d5908\u003C/MessageId\u003E\u003CInsertionTime\u003EThu, 19 Nov 2020 17:00:04 GMT\u003C/InsertionTime\u003E\u003CExpirationTime\u003EThu, 26 Nov 2020 17:00:04 GMT\u003C/ExpirationTime\u003E\u003CPopReceipt\u003EAgAAAAMAAAAAAAAAmPITbZW\u002B1gE=\u003C/PopReceipt\u003E\u003CTimeNextVisible\u003EThu, 19 Nov 2020 17:00:04 GMT\u003C/TimeNextVisible\u003E\u003C/QueueMessage\u003E\u003C/QueueMessagesList\u003E" + "ResponseBody": "\uFEFF\u003C?xml version=\u00221.0\u0022 encoding=\u0022utf-8\u0022?\u003E\u003CQueueMessagesList\u003E\u003CQueueMessage\u003E\u003CMessageId\u003E7fd09bf8-fe2c-4bb4-9861-d3bac4e6e4ba\u003C/MessageId\u003E\u003CInsertionTime\u003ETue, 26 Jan 2021 18:28:43 GMT\u003C/InsertionTime\u003E\u003CExpirationTime\u003ETue, 02 Feb 2021 18:28:43 GMT\u003C/ExpirationTime\u003E\u003CPopReceipt\u003EAgAAAAMAAAAAAAAAv13gExH01gE=\u003C/PopReceipt\u003E\u003CTimeNextVisible\u003ETue, 26 Jan 2021 18:28:43 GMT\u003C/TimeNextVisible\u003E\u003C/QueueMessage\u003E\u003C/QueueMessagesList\u003E" }, { - "RequestUri": "http://kasoboltest.queue.core.windows.net/test-queue-a0e452de-885f-cc3b-2ed6-639ca012364d/messages", + "RequestUri": "https://kasoboltest.queue.core.windows.net/test-queue-a0e452de-885f-cc3b-2ed6-639ca012364d/messages", "RequestMethod": "POST", "RequestHeaders": { + "Accept": "application/xml", "Authorization": "Sanitized", - "Content-Length": "72", + "Content-Length": "75", "Content-Type": "application/xml", - "traceparent": "00-c05c38356f5ac04387454ccfb07e5a9f-d0d385fc7ac9e542-00", + "traceparent": "00-6be1b97baad22643a90e05229cd83b5a-2a63e85a26e1a14c-00", "User-Agent": [ - "azsdk-net-Storage.Queues/12.6.0-alpha.20201119.1", - "(.NET Core 4.6.29321.03; Microsoft Windows 10.0.19042 )" + "azsdk-net-Storage.Queues/12.7.0-alpha.20210126.1", + "(.NET Framework 4.8.4250.0; Microsoft Windows 10.0.19042 )" ], "x-ms-client-request-id": "c4c665ce-5660-2397-ac26-6ca2718e63b7", - "x-ms-date": "Thu, 19 Nov 2020 17:00:04 GMT", + "x-ms-date": "Tue, 26 Jan 2021 18:28:44 GMT", "x-ms-return-client-request-id": "true", "x-ms-version": "2018-11-09" }, - "RequestBody": "\u003CQueueMessage\u003E\u003CMessageText\u003EdGVzdF9jb250ZW50\u003C/MessageText\u003E\u003C/QueueMessage\u003E", + "RequestBody": "\uFEFF\u003CQueueMessage\u003E\u003CMessageText\u003EdGVzdF9jb250ZW50\u003C/MessageText\u003E\u003C/QueueMessage\u003E", "StatusCode": 201, "ResponseHeaders": { "Content-Type": "application/xml", - "Date": "Thu, 19 Nov 2020 17:00:03 GMT", + "Date": "Tue, 26 Jan 2021 18:28:43 GMT", "Server": [ "Windows-Azure-Queue/1.0", "Microsoft-HTTPAPI/2.0" ], "Transfer-Encoding": "chunked", - "x-ms-request-id": "34749e9e-1003-0071-0c95-be26ca000000", + "x-ms-request-id": "5a79fd07-b003-005e-5a11-f4a7f0000000", "x-ms-version": "2018-11-09" }, - "ResponseBody": "\uFEFF\u003C?xml version=\u00221.0\u0022 encoding=\u0022utf-8\u0022?\u003E\u003CQueueMessagesList\u003E\u003CQueueMessage\u003E\u003CMessageId\u003E5d0e1710-f939-48d1-9a8f-3889baf42293\u003C/MessageId\u003E\u003CInsertionTime\u003EThu, 19 Nov 2020 17:00:04 GMT\u003C/InsertionTime\u003E\u003CExpirationTime\u003EThu, 26 Nov 2020 17:00:04 GMT\u003C/ExpirationTime\u003E\u003CPopReceipt\u003EAgAAAAMAAAAAAAAAYN8dbZW\u002B1gE=\u003C/PopReceipt\u003E\u003CTimeNextVisible\u003EThu, 19 Nov 2020 17:00:04 GMT\u003C/TimeNextVisible\u003E\u003C/QueueMessage\u003E\u003C/QueueMessagesList\u003E" + "ResponseBody": "\uFEFF\u003C?xml version=\u00221.0\u0022 encoding=\u0022utf-8\u0022?\u003E\u003CQueueMessagesList\u003E\u003CQueueMessage\u003E\u003CMessageId\u003E0a96b36c-c6f0-4921-8667-04ca70db6818\u003C/MessageId\u003E\u003CInsertionTime\u003ETue, 26 Jan 2021 18:28:44 GMT\u003C/InsertionTime\u003E\u003CExpirationTime\u003ETue, 02 Feb 2021 18:28:44 GMT\u003C/ExpirationTime\u003E\u003CPopReceipt\u003EAgAAAAMAAAAAAAAA1C/4ExH01gE=\u003C/PopReceipt\u003E\u003CTimeNextVisible\u003ETue, 26 Jan 2021 18:28:44 GMT\u003C/TimeNextVisible\u003E\u003C/QueueMessage\u003E\u003C/QueueMessagesList\u003E" }, { - "RequestUri": "http://kasoboltest.queue.core.windows.net/test-queue-a0e452de-885f-cc3b-2ed6-639ca012364d/messages?peekonly=true\u0026numofmessages=10", + "RequestUri": "https://kasoboltest.queue.core.windows.net/test-queue-a0e452de-885f-cc3b-2ed6-639ca012364d/messages?peekonly=true\u0026numofmessages=10", "RequestMethod": "GET", "RequestHeaders": { + "Accept": "application/xml", "Authorization": "Sanitized", - "traceparent": "00-3c50091a0a055f4aa10463a5d196dc83-168bbf71d9a06244-00", + "traceparent": "00-da01f20cd57d754e88b80fa744d5a3b2-1bdb30bae1e50145-00", "User-Agent": [ - "azsdk-net-Storage.Queues/12.6.0-alpha.20201119.1", - "(.NET Core 4.6.29321.03; Microsoft Windows 10.0.19042 )" + "azsdk-net-Storage.Queues/12.7.0-alpha.20210126.1", + "(.NET Framework 4.8.4250.0; Microsoft Windows 10.0.19042 )" ], "x-ms-client-request-id": "915f6bfe-4a76-5662-008d-15ecbbe72d73", - "x-ms-date": "Thu, 19 Nov 2020 17:00:04 GMT", + "x-ms-date": "Tue, 26 Jan 2021 18:28:44 GMT", "x-ms-return-client-request-id": "true", "x-ms-version": "2018-11-09" }, @@ -113,30 +117,31 @@ "ResponseHeaders": { "Cache-Control": "no-cache", "Content-Type": "application/xml", - "Date": "Thu, 19 Nov 2020 17:00:03 GMT", + "Date": "Tue, 26 Jan 2021 18:28:43 GMT", "Server": [ "Windows-Azure-Queue/1.0", "Microsoft-HTTPAPI/2.0" ], "Transfer-Encoding": "chunked", "Vary": "Origin", - "x-ms-request-id": "34749eb8-1003-0071-2295-be26ca000000", + "x-ms-request-id": "5a79fd27-b003-005e-7811-f4a7f0000000", "x-ms-version": "2018-11-09" }, - "ResponseBody": "\uFEFF\u003C?xml version=\u00221.0\u0022 encoding=\u0022utf-8\u0022?\u003E\u003CQueueMessagesList\u003E\u003CQueueMessage\u003E\u003CMessageId\u003Ef30896b0-d340-4f3f-9215-17060e8d5908\u003C/MessageId\u003E\u003CInsertionTime\u003EThu, 19 Nov 2020 17:00:04 GMT\u003C/InsertionTime\u003E\u003CExpirationTime\u003EThu, 26 Nov 2020 17:00:04 GMT\u003C/ExpirationTime\u003E\u003CDequeueCount\u003E0\u003C/DequeueCount\u003E\u003CMessageText\u003Etest_content\u003C/MessageText\u003E\u003C/QueueMessage\u003E\u003CQueueMessage\u003E\u003CMessageId\u003E5d0e1710-f939-48d1-9a8f-3889baf42293\u003C/MessageId\u003E\u003CInsertionTime\u003EThu, 19 Nov 2020 17:00:04 GMT\u003C/InsertionTime\u003E\u003CExpirationTime\u003EThu, 26 Nov 2020 17:00:04 GMT\u003C/ExpirationTime\u003E\u003CDequeueCount\u003E0\u003C/DequeueCount\u003E\u003CMessageText\u003EdGVzdF9jb250ZW50\u003C/MessageText\u003E\u003C/QueueMessage\u003E\u003C/QueueMessagesList\u003E" + "ResponseBody": "\uFEFF\u003C?xml version=\u00221.0\u0022 encoding=\u0022utf-8\u0022?\u003E\u003CQueueMessagesList\u003E\u003CQueueMessage\u003E\u003CMessageId\u003E7fd09bf8-fe2c-4bb4-9861-d3bac4e6e4ba\u003C/MessageId\u003E\u003CInsertionTime\u003ETue, 26 Jan 2021 18:28:43 GMT\u003C/InsertionTime\u003E\u003CExpirationTime\u003ETue, 02 Feb 2021 18:28:43 GMT\u003C/ExpirationTime\u003E\u003CDequeueCount\u003E0\u003C/DequeueCount\u003E\u003CMessageText\u003Etest_content\u003C/MessageText\u003E\u003C/QueueMessage\u003E\u003CQueueMessage\u003E\u003CMessageId\u003E0a96b36c-c6f0-4921-8667-04ca70db6818\u003C/MessageId\u003E\u003CInsertionTime\u003ETue, 26 Jan 2021 18:28:44 GMT\u003C/InsertionTime\u003E\u003CExpirationTime\u003ETue, 02 Feb 2021 18:28:44 GMT\u003C/ExpirationTime\u003E\u003CDequeueCount\u003E0\u003C/DequeueCount\u003E\u003CMessageText\u003EdGVzdF9jb250ZW50\u003C/MessageText\u003E\u003C/QueueMessage\u003E\u003C/QueueMessagesList\u003E" }, { - "RequestUri": "http://kasoboltest.queue.core.windows.net/test-queue-a0e452de-885f-cc3b-2ed6-639ca012364d", + "RequestUri": "https://kasoboltest.queue.core.windows.net/test-queue-a0e452de-885f-cc3b-2ed6-639ca012364d", "RequestMethod": "DELETE", "RequestHeaders": { + "Accept": "application/xml", "Authorization": "Sanitized", - "traceparent": "00-785d8490ff76de41a055af405939d5c1-73a650beed285a42-00", + "traceparent": "00-de37f9e8d02a66428ce2179a457e6859-58590dc61bede04a-00", "User-Agent": [ - "azsdk-net-Storage.Queues/12.6.0-alpha.20201119.1", - "(.NET Core 4.6.29321.03; Microsoft Windows 10.0.19042 )" + "azsdk-net-Storage.Queues/12.7.0-alpha.20210126.1", + "(.NET Framework 4.8.4250.0; Microsoft Windows 10.0.19042 )" ], "x-ms-client-request-id": "06a4ebf0-d12e-fc41-ba76-aad714287749", - "x-ms-date": "Thu, 19 Nov 2020 17:00:04 GMT", + "x-ms-date": "Tue, 26 Jan 2021 18:28:44 GMT", "x-ms-return-client-request-id": "true", "x-ms-version": "2018-11-09" }, @@ -144,12 +149,12 @@ "StatusCode": 204, "ResponseHeaders": { "Content-Length": "0", - "Date": "Thu, 19 Nov 2020 17:00:04 GMT", + "Date": "Tue, 26 Jan 2021 18:28:44 GMT", "Server": [ "Windows-Azure-Queue/1.0", "Microsoft-HTTPAPI/2.0" ], - "x-ms-request-id": "3db5c448-9003-0049-1295-be6793000000", + "x-ms-request-id": "99f58456-4003-0062-5b11-f4132b000000", "x-ms-version": "2018-11-09" }, "ResponseBody": [] @@ -157,6 +162,6 @@ ], "Variables": { "RandomSeed": "1524474571", - "Storage_TestConfigDefault": "ProductionTenant\nkasoboltest\nU2FuaXRpemVk\nhttp://kasoboltest.blob.core.windows.net\nhttp://kasoboltest.file.core.windows.net\nhttp://kasoboltest.queue.core.windows.net\nhttp://kasoboltest.table.core.windows.net\n\n\n\n\nhttp://kasoboltest-secondary.blob.core.windows.net\nhttp://kasoboltest-secondary.file.core.windows.net\nhttp://kasoboltest-secondary.queue.core.windows.net\nhttp://kasoboltest-secondary.table.core.windows.net\n\nSanitized\n\n\nCloud\nBlobEndpoint=http://kasoboltest.blob.core.windows.net/;QueueEndpoint=http://kasoboltest.queue.core.windows.net/;FileEndpoint=http://kasoboltest.file.core.windows.net/;BlobSecondaryEndpoint=http://kasoboltest-secondary.blob.core.windows.net/;QueueSecondaryEndpoint=http://kasoboltest-secondary.queue.core.windows.net/;FileSecondaryEndpoint=http://kasoboltest-secondary.file.core.windows.net/;AccountName=kasoboltest;AccountKey=Kg==;\nencryptionScope" + "Storage_TestConfigDefault": "ProductionTenant\nkasoboltest\nU2FuaXRpemVk\nhttps://kasoboltest.blob.core.windows.net\nhttps://kasoboltest.file.core.windows.net\nhttps://kasoboltest.queue.core.windows.net\nhttps://kasoboltest.table.core.windows.net\n\n\n\n\nhttps://kasoboltest-secondary.blob.core.windows.net\nhttps://kasoboltest-secondary.file.core.windows.net\nhttps://kasoboltest-secondary.queue.core.windows.net\nhttps://kasoboltest-secondary.table.core.windows.net\n\nSanitized\n\n\nCloud\nBlobEndpoint=https://kasoboltest.blob.core.windows.net/;QueueEndpoint=https://kasoboltest.queue.core.windows.net/;FileEndpoint=https://kasoboltest.file.core.windows.net/;BlobSecondaryEndpoint=https://kasoboltest-secondary.blob.core.windows.net/;QueueSecondaryEndpoint=https://kasoboltest-secondary.queue.core.windows.net/;FileSecondaryEndpoint=https://kasoboltest-secondary.file.core.windows.net/;AccountName=kasoboltest;AccountKey=Kg==;\nencryptionScope" } } \ No newline at end of file diff --git a/sdk/storage/Azure.Storage.Queues/tests/SessionRecords/QueueClientTests/FailsOnInvalidPeekedMessageIfNoHandlerIsProvided.json b/sdk/storage/Azure.Storage.Queues/tests/SessionRecords/QueueClientTests/FailsOnInvalidPeekedMessageIfNoHandlerIsProvided.json index a1491955043b0..556829d45496e 100644 --- a/sdk/storage/Azure.Storage.Queues/tests/SessionRecords/QueueClientTests/FailsOnInvalidPeekedMessageIfNoHandlerIsProvided.json +++ b/sdk/storage/Azure.Storage.Queues/tests/SessionRecords/QueueClientTests/FailsOnInvalidPeekedMessageIfNoHandlerIsProvided.json @@ -1,17 +1,18 @@ { "Entries": [ { - "RequestUri": "http://kasoboltest.queue.core.windows.net/test-queue-a526a502-4001-605b-b7da-4dca08918a1f", + "RequestUri": "https://kasoboltest.queue.core.windows.net/test-queue-a526a502-4001-605b-b7da-4dca08918a1f", "RequestMethod": "PUT", "RequestHeaders": { + "Accept": "application/xml", "Authorization": "Sanitized", - "traceparent": "00-6efde924efa19245a6ac4eb7caf41008-240b194335f58f49-00", + "traceparent": "00-25da6222f7cc5e4aa641b63324c59e49-8f3a1a7b80682e46-00", "User-Agent": [ - "azsdk-net-Storage.Queues/12.6.0-alpha.20201119.1", - "(.NET Core 4.6.29321.03; Microsoft Windows 10.0.19042 )" + "azsdk-net-Storage.Queues/12.7.0-alpha.20210126.1", + "(.NET Framework 4.8.4250.0; Microsoft Windows 10.0.19042 )" ], "x-ms-client-request-id": "fd0bc578-d298-e78b-db47-57c65a681c37", - "x-ms-date": "Thu, 19 Nov 2020 16:59:55 GMT", + "x-ms-date": "Tue, 26 Jan 2021 18:29:05 GMT", "x-ms-return-client-request-id": "true", "x-ms-version": "2018-11-09" }, @@ -19,60 +20,62 @@ "StatusCode": 201, "ResponseHeaders": { "Content-Length": "0", - "Date": "Thu, 19 Nov 2020 16:59:54 GMT", + "Date": "Tue, 26 Jan 2021 18:29:05 GMT", "Server": [ "Windows-Azure-Queue/1.0", "Microsoft-HTTPAPI/2.0" ], - "x-ms-request-id": "0d9dc060-a003-0027-2095-beceba000000", + "x-ms-request-id": "23f410b9-3003-006d-1d11-f4fedd000000", "x-ms-version": "2018-11-09" }, "ResponseBody": [] }, { - "RequestUri": "http://kasoboltest.queue.core.windows.net/test-queue-a526a502-4001-605b-b7da-4dca08918a1f/messages", + "RequestUri": "https://kasoboltest.queue.core.windows.net/test-queue-a526a502-4001-605b-b7da-4dca08918a1f/messages", "RequestMethod": "POST", "RequestHeaders": { + "Accept": "application/xml", "Authorization": "Sanitized", - "Content-Length": "68", + "Content-Length": "71", "Content-Type": "application/xml", - "traceparent": "00-ec854659a2a1db4fb9f1f8386820b178-f19ed45843c26b4e-00", + "traceparent": "00-378ecb03cdb2c5449d0ab77b217f0ab9-b7851010166f0e48-00", "User-Agent": [ - "azsdk-net-Storage.Queues/12.6.0-alpha.20201119.1", - "(.NET Core 4.6.29321.03; Microsoft Windows 10.0.19042 )" + "azsdk-net-Storage.Queues/12.7.0-alpha.20210126.1", + "(.NET Framework 4.8.4250.0; Microsoft Windows 10.0.19042 )" ], "x-ms-client-request-id": "4251e8ca-8c85-f587-2f79-8b96f0068ffb", - "x-ms-date": "Thu, 19 Nov 2020 16:59:55 GMT", + "x-ms-date": "Tue, 26 Jan 2021 18:29:06 GMT", "x-ms-return-client-request-id": "true", "x-ms-version": "2018-11-09" }, - "RequestBody": "\u003CQueueMessage\u003E\u003CMessageText\u003Etest_content\u003C/MessageText\u003E\u003C/QueueMessage\u003E", + "RequestBody": "\uFEFF\u003CQueueMessage\u003E\u003CMessageText\u003Etest_content\u003C/MessageText\u003E\u003C/QueueMessage\u003E", "StatusCode": 201, "ResponseHeaders": { "Content-Type": "application/xml", - "Date": "Thu, 19 Nov 2020 16:59:54 GMT", + "Date": "Tue, 26 Jan 2021 18:29:05 GMT", "Server": [ "Windows-Azure-Queue/1.0", "Microsoft-HTTPAPI/2.0" ], "Transfer-Encoding": "chunked", - "x-ms-request-id": "0d9dc0a0-a003-0027-5695-beceba000000", + "x-ms-request-id": "23f410e1-3003-006d-3c11-f4fedd000000", "x-ms-version": "2018-11-09" }, - "ResponseBody": "\uFEFF\u003C?xml version=\u00221.0\u0022 encoding=\u0022utf-8\u0022?\u003E\u003CQueueMessagesList\u003E\u003CQueueMessage\u003E\u003CMessageId\u003Ed675e8af-4373-4817-8e9f-575786d808a3\u003C/MessageId\u003E\u003CInsertionTime\u003EThu, 19 Nov 2020 16:59:55 GMT\u003C/InsertionTime\u003E\u003CExpirationTime\u003EThu, 26 Nov 2020 16:59:55 GMT\u003C/ExpirationTime\u003E\u003CPopReceipt\u003EAgAAAAMAAAAAAAAABJ2bZ5W\u002B1gE=\u003C/PopReceipt\u003E\u003CTimeNextVisible\u003EThu, 19 Nov 2020 16:59:55 GMT\u003C/TimeNextVisible\u003E\u003C/QueueMessage\u003E\u003C/QueueMessagesList\u003E" + "ResponseBody": "\uFEFF\u003C?xml version=\u00221.0\u0022 encoding=\u0022utf-8\u0022?\u003E\u003CQueueMessagesList\u003E\u003CQueueMessage\u003E\u003CMessageId\u003Eb8fb7623-735d-4bd0-b078-e870a29bbe12\u003C/MessageId\u003E\u003CInsertionTime\u003ETue, 26 Jan 2021 18:29:06 GMT\u003C/InsertionTime\u003E\u003CExpirationTime\u003ETue, 02 Feb 2021 18:29:06 GMT\u003C/ExpirationTime\u003E\u003CPopReceipt\u003EAgAAAAMAAAAAAAAAHhosIRH01gE=\u003C/PopReceipt\u003E\u003CTimeNextVisible\u003ETue, 26 Jan 2021 18:29:06 GMT\u003C/TimeNextVisible\u003E\u003C/QueueMessage\u003E\u003C/QueueMessagesList\u003E" }, { - "RequestUri": "http://kasoboltest.queue.core.windows.net/test-queue-a526a502-4001-605b-b7da-4dca08918a1f/messages?peekonly=true", + "RequestUri": "https://kasoboltest.queue.core.windows.net/test-queue-a526a502-4001-605b-b7da-4dca08918a1f/messages?peekonly=true", "RequestMethod": "GET", "RequestHeaders": { + "Accept": "application/xml", "Authorization": "Sanitized", - "traceparent": "00-92692d8508d45a449a62a33968d2e3dd-a5c86bde2bcad84f-00", + "traceparent": "00-0e811d6feb928040b6a976085120b91f-9562ad73a963694a-00", "User-Agent": [ - "azsdk-net-Storage.Queues/12.6.0-alpha.20201119.1", - "(.NET Core 4.6.29321.03; Microsoft Windows 10.0.19042 )" + "azsdk-net-Storage.Queues/12.7.0-alpha.20210126.1", + "(.NET Framework 4.8.4250.0; Microsoft Windows 10.0.19042 )" ], "x-ms-client-request-id": "71fc6e09-da16-7bb1-0df3-4f12cf42cbd1", - "x-ms-date": "Thu, 19 Nov 2020 16:59:55 GMT", + "x-ms-date": "Tue, 26 Jan 2021 18:29:06 GMT", "x-ms-return-client-request-id": "true", "x-ms-version": "2018-11-09" }, @@ -81,30 +84,31 @@ "ResponseHeaders": { "Cache-Control": "no-cache", "Content-Type": "application/xml", - "Date": "Thu, 19 Nov 2020 16:59:54 GMT", + "Date": "Tue, 26 Jan 2021 18:29:05 GMT", "Server": [ "Windows-Azure-Queue/1.0", "Microsoft-HTTPAPI/2.0" ], "Transfer-Encoding": "chunked", "Vary": "Origin", - "x-ms-request-id": "8885a00f-1003-0035-4895-befaa6000000", + "x-ms-request-id": "d97c6980-d003-000a-1911-f44d7a000000", "x-ms-version": "2018-11-09" }, - "ResponseBody": "\uFEFF\u003C?xml version=\u00221.0\u0022 encoding=\u0022utf-8\u0022?\u003E\u003CQueueMessagesList\u003E\u003CQueueMessage\u003E\u003CMessageId\u003Ed675e8af-4373-4817-8e9f-575786d808a3\u003C/MessageId\u003E\u003CInsertionTime\u003EThu, 19 Nov 2020 16:59:55 GMT\u003C/InsertionTime\u003E\u003CExpirationTime\u003EThu, 26 Nov 2020 16:59:55 GMT\u003C/ExpirationTime\u003E\u003CDequeueCount\u003E0\u003C/DequeueCount\u003E\u003CMessageText\u003Etest_content\u003C/MessageText\u003E\u003C/QueueMessage\u003E\u003C/QueueMessagesList\u003E" + "ResponseBody": "\uFEFF\u003C?xml version=\u00221.0\u0022 encoding=\u0022utf-8\u0022?\u003E\u003CQueueMessagesList\u003E\u003CQueueMessage\u003E\u003CMessageId\u003Eb8fb7623-735d-4bd0-b078-e870a29bbe12\u003C/MessageId\u003E\u003CInsertionTime\u003ETue, 26 Jan 2021 18:29:06 GMT\u003C/InsertionTime\u003E\u003CExpirationTime\u003ETue, 02 Feb 2021 18:29:06 GMT\u003C/ExpirationTime\u003E\u003CDequeueCount\u003E0\u003C/DequeueCount\u003E\u003CMessageText\u003Etest_content\u003C/MessageText\u003E\u003C/QueueMessage\u003E\u003C/QueueMessagesList\u003E" }, { - "RequestUri": "http://kasoboltest.queue.core.windows.net/test-queue-a526a502-4001-605b-b7da-4dca08918a1f", + "RequestUri": "https://kasoboltest.queue.core.windows.net/test-queue-a526a502-4001-605b-b7da-4dca08918a1f", "RequestMethod": "DELETE", "RequestHeaders": { + "Accept": "application/xml", "Authorization": "Sanitized", - "traceparent": "00-fc0790481d9dc3468a4575a5e72b8296-4667c041fe719f4d-00", + "traceparent": "00-0ae3b76a2ad75149883842a9204a42e7-98d2b2beb47c0e44-00", "User-Agent": [ - "azsdk-net-Storage.Queues/12.6.0-alpha.20201119.1", - "(.NET Core 4.6.29321.03; Microsoft Windows 10.0.19042 )" + "azsdk-net-Storage.Queues/12.7.0-alpha.20210126.1", + "(.NET Framework 4.8.4250.0; Microsoft Windows 10.0.19042 )" ], "x-ms-client-request-id": "818c963c-1d0a-d1e4-acf1-7ef341c64eab", - "x-ms-date": "Thu, 19 Nov 2020 16:59:55 GMT", + "x-ms-date": "Tue, 26 Jan 2021 18:29:06 GMT", "x-ms-return-client-request-id": "true", "x-ms-version": "2018-11-09" }, @@ -112,12 +116,12 @@ "StatusCode": 204, "ResponseHeaders": { "Content-Length": "0", - "Date": "Thu, 19 Nov 2020 16:59:55 GMT", + "Date": "Tue, 26 Jan 2021 18:29:05 GMT", "Server": [ "Windows-Azure-Queue/1.0", "Microsoft-HTTPAPI/2.0" ], - "x-ms-request-id": "0d9dc116-a003-0027-4995-beceba000000", + "x-ms-request-id": "23f41118-3003-006d-7111-f4fedd000000", "x-ms-version": "2018-11-09" }, "ResponseBody": [] @@ -125,6 +129,6 @@ ], "Variables": { "RandomSeed": "531594792", - "Storage_TestConfigDefault": "ProductionTenant\nkasoboltest\nU2FuaXRpemVk\nhttp://kasoboltest.blob.core.windows.net\nhttp://kasoboltest.file.core.windows.net\nhttp://kasoboltest.queue.core.windows.net\nhttp://kasoboltest.table.core.windows.net\n\n\n\n\nhttp://kasoboltest-secondary.blob.core.windows.net\nhttp://kasoboltest-secondary.file.core.windows.net\nhttp://kasoboltest-secondary.queue.core.windows.net\nhttp://kasoboltest-secondary.table.core.windows.net\n\nSanitized\n\n\nCloud\nBlobEndpoint=http://kasoboltest.blob.core.windows.net/;QueueEndpoint=http://kasoboltest.queue.core.windows.net/;FileEndpoint=http://kasoboltest.file.core.windows.net/;BlobSecondaryEndpoint=http://kasoboltest-secondary.blob.core.windows.net/;QueueSecondaryEndpoint=http://kasoboltest-secondary.queue.core.windows.net/;FileSecondaryEndpoint=http://kasoboltest-secondary.file.core.windows.net/;AccountName=kasoboltest;AccountKey=Kg==;\nencryptionScope" + "Storage_TestConfigDefault": "ProductionTenant\nkasoboltest\nU2FuaXRpemVk\nhttps://kasoboltest.blob.core.windows.net\nhttps://kasoboltest.file.core.windows.net\nhttps://kasoboltest.queue.core.windows.net\nhttps://kasoboltest.table.core.windows.net\n\n\n\n\nhttps://kasoboltest-secondary.blob.core.windows.net\nhttps://kasoboltest-secondary.file.core.windows.net\nhttps://kasoboltest-secondary.queue.core.windows.net\nhttps://kasoboltest-secondary.table.core.windows.net\n\nSanitized\n\n\nCloud\nBlobEndpoint=https://kasoboltest.blob.core.windows.net/;QueueEndpoint=https://kasoboltest.queue.core.windows.net/;FileEndpoint=https://kasoboltest.file.core.windows.net/;BlobSecondaryEndpoint=https://kasoboltest-secondary.blob.core.windows.net/;QueueSecondaryEndpoint=https://kasoboltest-secondary.queue.core.windows.net/;FileSecondaryEndpoint=https://kasoboltest-secondary.file.core.windows.net/;AccountName=kasoboltest;AccountKey=Kg==;\nencryptionScope" } } \ No newline at end of file diff --git a/sdk/storage/Azure.Storage.Queues/tests/SessionRecords/QueueClientTests/FailsOnInvalidPeekedMessageIfNoHandlerIsProvidedAsync.json b/sdk/storage/Azure.Storage.Queues/tests/SessionRecords/QueueClientTests/FailsOnInvalidPeekedMessageIfNoHandlerIsProvidedAsync.json index e9e03f2adc0c9..7965463c3a39e 100644 --- a/sdk/storage/Azure.Storage.Queues/tests/SessionRecords/QueueClientTests/FailsOnInvalidPeekedMessageIfNoHandlerIsProvidedAsync.json +++ b/sdk/storage/Azure.Storage.Queues/tests/SessionRecords/QueueClientTests/FailsOnInvalidPeekedMessageIfNoHandlerIsProvidedAsync.json @@ -1,17 +1,18 @@ { "Entries": [ { - "RequestUri": "http://kasoboltest.queue.core.windows.net/test-queue-cc4458e5-ec24-cc32-7616-10a6fad89eb8", + "RequestUri": "https://kasoboltest.queue.core.windows.net/test-queue-cc4458e5-ec24-cc32-7616-10a6fad89eb8", "RequestMethod": "PUT", "RequestHeaders": { + "Accept": "application/xml", "Authorization": "Sanitized", - "traceparent": "00-fcc6c7dacdab97408847dd5de434a153-3ca91197be7bc54a-00", + "traceparent": "00-660d5c76a8d65a4abbdfe8a853fb6f6f-b3c3435c1c479442-00", "User-Agent": [ - "azsdk-net-Storage.Queues/12.6.0-alpha.20201119.1", - "(.NET Core 4.6.29321.03; Microsoft Windows 10.0.19042 )" + "azsdk-net-Storage.Queues/12.7.0-alpha.20210126.1", + "(.NET Framework 4.8.4250.0; Microsoft Windows 10.0.19042 )" ], "x-ms-client-request-id": "b072c23b-d1f7-bf0e-6c08-e90c9ba03df9", - "x-ms-date": "Thu, 19 Nov 2020 16:59:55 GMT", + "x-ms-date": "Tue, 26 Jan 2021 18:29:06 GMT", "x-ms-return-client-request-id": "true", "x-ms-version": "2018-11-09" }, @@ -19,60 +20,62 @@ "StatusCode": 201, "ResponseHeaders": { "Content-Length": "0", - "Date": "Thu, 19 Nov 2020 16:59:55 GMT", + "Date": "Tue, 26 Jan 2021 18:29:05 GMT", "Server": [ "Windows-Azure-Queue/1.0", "Microsoft-HTTPAPI/2.0" ], - "x-ms-request-id": "6287b497-0003-006e-3995-befdda000000", + "x-ms-request-id": "e5723ac6-1003-0017-3a11-f49490000000", "x-ms-version": "2018-11-09" }, "ResponseBody": [] }, { - "RequestUri": "http://kasoboltest.queue.core.windows.net/test-queue-cc4458e5-ec24-cc32-7616-10a6fad89eb8/messages", + "RequestUri": "https://kasoboltest.queue.core.windows.net/test-queue-cc4458e5-ec24-cc32-7616-10a6fad89eb8/messages", "RequestMethod": "POST", "RequestHeaders": { + "Accept": "application/xml", "Authorization": "Sanitized", - "Content-Length": "68", + "Content-Length": "71", "Content-Type": "application/xml", - "traceparent": "00-a15be0cc23ab7c4887cfbdef1a401b03-ceda4396da0a554e-00", + "traceparent": "00-7479228d843c64489afa43d648caabbd-b161059b7327b14f-00", "User-Agent": [ - "azsdk-net-Storage.Queues/12.6.0-alpha.20201119.1", - "(.NET Core 4.6.29321.03; Microsoft Windows 10.0.19042 )" + "azsdk-net-Storage.Queues/12.7.0-alpha.20210126.1", + "(.NET Framework 4.8.4250.0; Microsoft Windows 10.0.19042 )" ], "x-ms-client-request-id": "376a55e0-ed65-bbc0-d569-0b304b5c692b", - "x-ms-date": "Thu, 19 Nov 2020 16:59:55 GMT", + "x-ms-date": "Tue, 26 Jan 2021 18:29:06 GMT", "x-ms-return-client-request-id": "true", "x-ms-version": "2018-11-09" }, - "RequestBody": "\u003CQueueMessage\u003E\u003CMessageText\u003Etest_content\u003C/MessageText\u003E\u003C/QueueMessage\u003E", + "RequestBody": "\uFEFF\u003CQueueMessage\u003E\u003CMessageText\u003Etest_content\u003C/MessageText\u003E\u003C/QueueMessage\u003E", "StatusCode": 201, "ResponseHeaders": { "Content-Type": "application/xml", - "Date": "Thu, 19 Nov 2020 16:59:55 GMT", + "Date": "Tue, 26 Jan 2021 18:29:05 GMT", "Server": [ "Windows-Azure-Queue/1.0", "Microsoft-HTTPAPI/2.0" ], "Transfer-Encoding": "chunked", - "x-ms-request-id": "6287b4b7-0003-006e-5795-befdda000000", + "x-ms-request-id": "e5723aca-1003-0017-3c11-f49490000000", "x-ms-version": "2018-11-09" }, - "ResponseBody": "\uFEFF\u003C?xml version=\u00221.0\u0022 encoding=\u0022utf-8\u0022?\u003E\u003CQueueMessagesList\u003E\u003CQueueMessage\u003E\u003CMessageId\u003Eaae6a382-e783-4da5-a7bf-0b31fe0fca3a\u003C/MessageId\u003E\u003CInsertionTime\u003EThu, 19 Nov 2020 16:59:55 GMT\u003C/InsertionTime\u003E\u003CExpirationTime\u003EThu, 26 Nov 2020 16:59:55 GMT\u003C/ExpirationTime\u003E\u003CPopReceipt\u003EAgAAAAMAAAAAAAAAZa7PZ5W\u002B1gE=\u003C/PopReceipt\u003E\u003CTimeNextVisible\u003EThu, 19 Nov 2020 16:59:55 GMT\u003C/TimeNextVisible\u003E\u003C/QueueMessage\u003E\u003C/QueueMessagesList\u003E" + "ResponseBody": "\uFEFF\u003C?xml version=\u00221.0\u0022 encoding=\u0022utf-8\u0022?\u003E\u003CQueueMessagesList\u003E\u003CQueueMessage\u003E\u003CMessageId\u003Eff10d6c1-6379-4f52-b5c0-99ec39ebc9b1\u003C/MessageId\u003E\u003CInsertionTime\u003ETue, 26 Jan 2021 18:29:06 GMT\u003C/InsertionTime\u003E\u003CExpirationTime\u003ETue, 02 Feb 2021 18:29:06 GMT\u003C/ExpirationTime\u003E\u003CPopReceipt\u003EAgAAAAMAAAAAAAAA\u002B8h0IRH01gE=\u003C/PopReceipt\u003E\u003CTimeNextVisible\u003ETue, 26 Jan 2021 18:29:06 GMT\u003C/TimeNextVisible\u003E\u003C/QueueMessage\u003E\u003C/QueueMessagesList\u003E" }, { - "RequestUri": "http://kasoboltest.queue.core.windows.net/test-queue-cc4458e5-ec24-cc32-7616-10a6fad89eb8/messages?peekonly=true", + "RequestUri": "https://kasoboltest.queue.core.windows.net/test-queue-cc4458e5-ec24-cc32-7616-10a6fad89eb8/messages?peekonly=true", "RequestMethod": "GET", "RequestHeaders": { + "Accept": "application/xml", "Authorization": "Sanitized", - "traceparent": "00-cd79b00710ed174786d0ab4ef149f92d-6ae586c8ee01aa47-00", + "traceparent": "00-716a29378a94c6409bc587ac7942758d-135f3fb21f94f74e-00", "User-Agent": [ - "azsdk-net-Storage.Queues/12.6.0-alpha.20201119.1", - "(.NET Core 4.6.29321.03; Microsoft Windows 10.0.19042 )" + "azsdk-net-Storage.Queues/12.7.0-alpha.20210126.1", + "(.NET Framework 4.8.4250.0; Microsoft Windows 10.0.19042 )" ], "x-ms-client-request-id": "462b07bf-0636-9994-c3fd-48e096896492", - "x-ms-date": "Thu, 19 Nov 2020 16:59:55 GMT", + "x-ms-date": "Tue, 26 Jan 2021 18:29:06 GMT", "x-ms-return-client-request-id": "true", "x-ms-version": "2018-11-09" }, @@ -81,30 +84,31 @@ "ResponseHeaders": { "Cache-Control": "no-cache", "Content-Type": "application/xml", - "Date": "Thu, 19 Nov 2020 16:59:55 GMT", + "Date": "Tue, 26 Jan 2021 18:29:05 GMT", "Server": [ "Windows-Azure-Queue/1.0", "Microsoft-HTTPAPI/2.0" ], "Transfer-Encoding": "chunked", "Vary": "Origin", - "x-ms-request-id": "01b01ab4-8003-0030-3295-be0ed9000000", + "x-ms-request-id": "a0fd0767-9003-0060-5b11-f411d1000000", "x-ms-version": "2018-11-09" }, - "ResponseBody": "\uFEFF\u003C?xml version=\u00221.0\u0022 encoding=\u0022utf-8\u0022?\u003E\u003CQueueMessagesList\u003E\u003CQueueMessage\u003E\u003CMessageId\u003Eaae6a382-e783-4da5-a7bf-0b31fe0fca3a\u003C/MessageId\u003E\u003CInsertionTime\u003EThu, 19 Nov 2020 16:59:55 GMT\u003C/InsertionTime\u003E\u003CExpirationTime\u003EThu, 26 Nov 2020 16:59:55 GMT\u003C/ExpirationTime\u003E\u003CDequeueCount\u003E0\u003C/DequeueCount\u003E\u003CMessageText\u003Etest_content\u003C/MessageText\u003E\u003C/QueueMessage\u003E\u003C/QueueMessagesList\u003E" + "ResponseBody": "\uFEFF\u003C?xml version=\u00221.0\u0022 encoding=\u0022utf-8\u0022?\u003E\u003CQueueMessagesList\u003E\u003CQueueMessage\u003E\u003CMessageId\u003Eff10d6c1-6379-4f52-b5c0-99ec39ebc9b1\u003C/MessageId\u003E\u003CInsertionTime\u003ETue, 26 Jan 2021 18:29:06 GMT\u003C/InsertionTime\u003E\u003CExpirationTime\u003ETue, 02 Feb 2021 18:29:06 GMT\u003C/ExpirationTime\u003E\u003CDequeueCount\u003E0\u003C/DequeueCount\u003E\u003CMessageText\u003Etest_content\u003C/MessageText\u003E\u003C/QueueMessage\u003E\u003C/QueueMessagesList\u003E" }, { - "RequestUri": "http://kasoboltest.queue.core.windows.net/test-queue-cc4458e5-ec24-cc32-7616-10a6fad89eb8", + "RequestUri": "https://kasoboltest.queue.core.windows.net/test-queue-cc4458e5-ec24-cc32-7616-10a6fad89eb8", "RequestMethod": "DELETE", "RequestHeaders": { + "Accept": "application/xml", "Authorization": "Sanitized", - "traceparent": "00-1702f238935ca248bd0422d7d17a7d38-c0957f2e2f889146-00", + "traceparent": "00-9259e448211b4d45acbd7fa2139fff2f-0fc962adf86c754a-00", "User-Agent": [ - "azsdk-net-Storage.Queues/12.6.0-alpha.20201119.1", - "(.NET Core 4.6.29321.03; Microsoft Windows 10.0.19042 )" + "azsdk-net-Storage.Queues/12.7.0-alpha.20210126.1", + "(.NET Framework 4.8.4250.0; Microsoft Windows 10.0.19042 )" ], "x-ms-client-request-id": "4371298a-2231-fdf4-7d87-3adecf91037e", - "x-ms-date": "Thu, 19 Nov 2020 16:59:55 GMT", + "x-ms-date": "Tue, 26 Jan 2021 18:29:06 GMT", "x-ms-return-client-request-id": "true", "x-ms-version": "2018-11-09" }, @@ -112,12 +116,12 @@ "StatusCode": 204, "ResponseHeaders": { "Content-Length": "0", - "Date": "Thu, 19 Nov 2020 16:59:55 GMT", + "Date": "Tue, 26 Jan 2021 18:29:05 GMT", "Server": [ "Windows-Azure-Queue/1.0", "Microsoft-HTTPAPI/2.0" ], - "x-ms-request-id": "6287b4f4-0003-006e-1495-befdda000000", + "x-ms-request-id": "e5723ad6-1003-0017-4811-f49490000000", "x-ms-version": "2018-11-09" }, "ResponseBody": [] @@ -125,6 +129,6 @@ ], "Variables": { "RandomSeed": "907209100", - "Storage_TestConfigDefault": "ProductionTenant\nkasoboltest\nU2FuaXRpemVk\nhttp://kasoboltest.blob.core.windows.net\nhttp://kasoboltest.file.core.windows.net\nhttp://kasoboltest.queue.core.windows.net\nhttp://kasoboltest.table.core.windows.net\n\n\n\n\nhttp://kasoboltest-secondary.blob.core.windows.net\nhttp://kasoboltest-secondary.file.core.windows.net\nhttp://kasoboltest-secondary.queue.core.windows.net\nhttp://kasoboltest-secondary.table.core.windows.net\n\nSanitized\n\n\nCloud\nBlobEndpoint=http://kasoboltest.blob.core.windows.net/;QueueEndpoint=http://kasoboltest.queue.core.windows.net/;FileEndpoint=http://kasoboltest.file.core.windows.net/;BlobSecondaryEndpoint=http://kasoboltest-secondary.blob.core.windows.net/;QueueSecondaryEndpoint=http://kasoboltest-secondary.queue.core.windows.net/;FileSecondaryEndpoint=http://kasoboltest-secondary.file.core.windows.net/;AccountName=kasoboltest;AccountKey=Kg==;\nencryptionScope" + "Storage_TestConfigDefault": "ProductionTenant\nkasoboltest\nU2FuaXRpemVk\nhttps://kasoboltest.blob.core.windows.net\nhttps://kasoboltest.file.core.windows.net\nhttps://kasoboltest.queue.core.windows.net\nhttps://kasoboltest.table.core.windows.net\n\n\n\n\nhttps://kasoboltest-secondary.blob.core.windows.net\nhttps://kasoboltest-secondary.file.core.windows.net\nhttps://kasoboltest-secondary.queue.core.windows.net\nhttps://kasoboltest-secondary.table.core.windows.net\n\nSanitized\n\n\nCloud\nBlobEndpoint=https://kasoboltest.blob.core.windows.net/;QueueEndpoint=https://kasoboltest.queue.core.windows.net/;FileEndpoint=https://kasoboltest.file.core.windows.net/;BlobSecondaryEndpoint=https://kasoboltest-secondary.blob.core.windows.net/;QueueSecondaryEndpoint=https://kasoboltest-secondary.queue.core.windows.net/;FileSecondaryEndpoint=https://kasoboltest-secondary.file.core.windows.net/;AccountName=kasoboltest;AccountKey=Kg==;\nencryptionScope" } } \ No newline at end of file diff --git a/sdk/storage/Azure.Storage.Queues/tests/SessionRecords/QueueClientTests/FailsOnInvalidQueueMessageIfNoHandlerIsProvided.json b/sdk/storage/Azure.Storage.Queues/tests/SessionRecords/QueueClientTests/FailsOnInvalidQueueMessageIfNoHandlerIsProvided.json index 4ee0a07232215..57af94215a89f 100644 --- a/sdk/storage/Azure.Storage.Queues/tests/SessionRecords/QueueClientTests/FailsOnInvalidQueueMessageIfNoHandlerIsProvided.json +++ b/sdk/storage/Azure.Storage.Queues/tests/SessionRecords/QueueClientTests/FailsOnInvalidQueueMessageIfNoHandlerIsProvided.json @@ -1,17 +1,18 @@ { "Entries": [ { - "RequestUri": "http://kasoboltest.queue.core.windows.net/test-queue-186b9a2d-2db9-6a0b-f23c-b2fe3ac42f03", + "RequestUri": "https://kasoboltest.queue.core.windows.net/test-queue-186b9a2d-2db9-6a0b-f23c-b2fe3ac42f03", "RequestMethod": "PUT", "RequestHeaders": { + "Accept": "application/xml", "Authorization": "Sanitized", - "traceparent": "00-0367c5b549e5a54a851143eaf232e072-b5187cee6e459c4d-00", + "traceparent": "00-69b4f4b8d35d15489de0c4900330f1c3-4a32b10c5e59a54d-00", "User-Agent": [ - "azsdk-net-Storage.Queues/12.6.0-alpha.20201116.1", - "(.NET Core 4.6.29321.03; Microsoft Windows 10.0.19042 )" + "azsdk-net-Storage.Queues/12.7.0-alpha.20210126.1", + "(.NET Framework 4.8.4250.0; Microsoft Windows 10.0.19042 )" ], "x-ms-client-request-id": "737c90b1-5f3a-7018-428b-4360f1578525", - "x-ms-date": "Mon, 16 Nov 2020 22:31:54 GMT", + "x-ms-date": "Tue, 26 Jan 2021 18:29:19 GMT", "x-ms-return-client-request-id": "true", "x-ms-version": "2018-11-09" }, @@ -19,60 +20,62 @@ "StatusCode": 201, "ResponseHeaders": { "Content-Length": "0", - "Date": "Mon, 16 Nov 2020 22:31:54 GMT", + "Date": "Tue, 26 Jan 2021 18:29:19 GMT", "Server": [ "Windows-Azure-Queue/1.0", "Microsoft-HTTPAPI/2.0" ], - "x-ms-request-id": "1b4f3064-2003-005b-5c68-bc538f000000", + "x-ms-request-id": "65dd8af6-1003-0053-6911-f448fc000000", "x-ms-version": "2018-11-09" }, "ResponseBody": [] }, { - "RequestUri": "http://kasoboltest.queue.core.windows.net/test-queue-186b9a2d-2db9-6a0b-f23c-b2fe3ac42f03/messages", + "RequestUri": "https://kasoboltest.queue.core.windows.net/test-queue-186b9a2d-2db9-6a0b-f23c-b2fe3ac42f03/messages", "RequestMethod": "POST", "RequestHeaders": { + "Accept": "application/xml", "Authorization": "Sanitized", - "Content-Length": "68", + "Content-Length": "71", "Content-Type": "application/xml", - "traceparent": "00-a15446e5c6683d40852ebb55acb98933-61dec84972c4e640-00", + "traceparent": "00-f39c2dd9958e904d801720229e782708-3edff45ba5c5754b-00", "User-Agent": [ - "azsdk-net-Storage.Queues/12.6.0-alpha.20201116.1", - "(.NET Core 4.6.29321.03; Microsoft Windows 10.0.19042 )" + "azsdk-net-Storage.Queues/12.7.0-alpha.20210126.1", + "(.NET Framework 4.8.4250.0; Microsoft Windows 10.0.19042 )" ], "x-ms-client-request-id": "aa4d86ec-bb48-d2c8-5205-6763686dce10", - "x-ms-date": "Mon, 16 Nov 2020 22:31:54 GMT", + "x-ms-date": "Tue, 26 Jan 2021 18:29:19 GMT", "x-ms-return-client-request-id": "true", "x-ms-version": "2018-11-09" }, - "RequestBody": "\u003CQueueMessage\u003E\u003CMessageText\u003Etest_content\u003C/MessageText\u003E\u003C/QueueMessage\u003E", + "RequestBody": "\uFEFF\u003CQueueMessage\u003E\u003CMessageText\u003Etest_content\u003C/MessageText\u003E\u003C/QueueMessage\u003E", "StatusCode": 201, "ResponseHeaders": { "Content-Type": "application/xml", - "Date": "Mon, 16 Nov 2020 22:31:54 GMT", + "Date": "Tue, 26 Jan 2021 18:29:19 GMT", "Server": [ "Windows-Azure-Queue/1.0", "Microsoft-HTTPAPI/2.0" ], "Transfer-Encoding": "chunked", - "x-ms-request-id": "1b4f306f-2003-005b-6468-bc538f000000", + "x-ms-request-id": "65dd8af9-1003-0053-6a11-f448fc000000", "x-ms-version": "2018-11-09" }, - "ResponseBody": "\uFEFF\u003C?xml version=\u00221.0\u0022 encoding=\u0022utf-8\u0022?\u003E\u003CQueueMessagesList\u003E\u003CQueueMessage\u003E\u003CMessageId\u003Ea9c7ad5f-62e8-4b4e-880c-4ae7d82e537d\u003C/MessageId\u003E\u003CInsertionTime\u003EMon, 16 Nov 2020 22:31:54 GMT\u003C/InsertionTime\u003E\u003CExpirationTime\u003EMon, 23 Nov 2020 22:31:54 GMT\u003C/ExpirationTime\u003E\u003CPopReceipt\u003EAgAAAAMAAAAAAAAAgB9OSWi81gE=\u003C/PopReceipt\u003E\u003CTimeNextVisible\u003EMon, 16 Nov 2020 22:31:54 GMT\u003C/TimeNextVisible\u003E\u003C/QueueMessage\u003E\u003C/QueueMessagesList\u003E" + "ResponseBody": "\uFEFF\u003C?xml version=\u00221.0\u0022 encoding=\u0022utf-8\u0022?\u003E\u003CQueueMessagesList\u003E\u003CQueueMessage\u003E\u003CMessageId\u003E97e45397-9361-4642-b713-38053bc358fc\u003C/MessageId\u003E\u003CInsertionTime\u003ETue, 26 Jan 2021 18:29:19 GMT\u003C/InsertionTime\u003E\u003CExpirationTime\u003ETue, 02 Feb 2021 18:29:19 GMT\u003C/ExpirationTime\u003E\u003CPopReceipt\u003EAgAAAAMAAAAAAAAAhnFeKRH01gE=\u003C/PopReceipt\u003E\u003CTimeNextVisible\u003ETue, 26 Jan 2021 18:29:19 GMT\u003C/TimeNextVisible\u003E\u003C/QueueMessage\u003E\u003C/QueueMessagesList\u003E" }, { - "RequestUri": "http://kasoboltest.queue.core.windows.net/test-queue-186b9a2d-2db9-6a0b-f23c-b2fe3ac42f03/messages", + "RequestUri": "https://kasoboltest.queue.core.windows.net/test-queue-186b9a2d-2db9-6a0b-f23c-b2fe3ac42f03/messages", "RequestMethod": "GET", "RequestHeaders": { + "Accept": "application/xml", "Authorization": "Sanitized", - "traceparent": "00-4e31eda8ed12594783c37a0f54fe95a9-3961ccd47a928f4b-00", + "traceparent": "00-be6fc955ea65904d8953cac5980c4389-c996a62beb685245-00", "User-Agent": [ - "azsdk-net-Storage.Queues/12.6.0-alpha.20201116.1", - "(.NET Core 4.6.29321.03; Microsoft Windows 10.0.19042 )" + "azsdk-net-Storage.Queues/12.7.0-alpha.20210126.1", + "(.NET Framework 4.8.4250.0; Microsoft Windows 10.0.19042 )" ], "x-ms-client-request-id": "6a747034-db09-41dc-fa2b-a4071a3d185f", - "x-ms-date": "Mon, 16 Nov 2020 22:31:54 GMT", + "x-ms-date": "Tue, 26 Jan 2021 18:29:20 GMT", "x-ms-return-client-request-id": "true", "x-ms-version": "2018-11-09" }, @@ -81,30 +84,31 @@ "ResponseHeaders": { "Cache-Control": "no-cache", "Content-Type": "application/xml", - "Date": "Mon, 16 Nov 2020 22:31:54 GMT", + "Date": "Tue, 26 Jan 2021 18:29:19 GMT", "Server": [ "Windows-Azure-Queue/1.0", "Microsoft-HTTPAPI/2.0" ], "Transfer-Encoding": "chunked", "Vary": "Origin", - "x-ms-request-id": "8b3f4c2b-1003-001c-1f68-bc8ce4000000", + "x-ms-request-id": "442965a5-e003-004d-4e11-f49211000000", "x-ms-version": "2018-11-09" }, - "ResponseBody": "\uFEFF\u003C?xml version=\u00221.0\u0022 encoding=\u0022utf-8\u0022?\u003E\u003CQueueMessagesList\u003E\u003CQueueMessage\u003E\u003CMessageId\u003Ea9c7ad5f-62e8-4b4e-880c-4ae7d82e537d\u003C/MessageId\u003E\u003CInsertionTime\u003EMon, 16 Nov 2020 22:31:54 GMT\u003C/InsertionTime\u003E\u003CExpirationTime\u003EMon, 23 Nov 2020 22:31:54 GMT\u003C/ExpirationTime\u003E\u003CPopReceipt\u003EAgAAAAMAAAAAAAAANb08W2i81gE=\u003C/PopReceipt\u003E\u003CTimeNextVisible\u003EMon, 16 Nov 2020 22:32:24 GMT\u003C/TimeNextVisible\u003E\u003CDequeueCount\u003E1\u003C/DequeueCount\u003E\u003CMessageText\u003Etest_content\u003C/MessageText\u003E\u003C/QueueMessage\u003E\u003C/QueueMessagesList\u003E" + "ResponseBody": "\uFEFF\u003C?xml version=\u00221.0\u0022 encoding=\u0022utf-8\u0022?\u003E\u003CQueueMessagesList\u003E\u003CQueueMessage\u003E\u003CMessageId\u003E97e45397-9361-4642-b713-38053bc358fc\u003C/MessageId\u003E\u003CInsertionTime\u003ETue, 26 Jan 2021 18:29:19 GMT\u003C/InsertionTime\u003E\u003CExpirationTime\u003ETue, 02 Feb 2021 18:29:19 GMT\u003C/ExpirationTime\u003E\u003CPopReceipt\u003EAgAAAAMAAAAAAAAAYI5SOxH01gE=\u003C/PopReceipt\u003E\u003CTimeNextVisible\u003ETue, 26 Jan 2021 18:29:50 GMT\u003C/TimeNextVisible\u003E\u003CDequeueCount\u003E1\u003C/DequeueCount\u003E\u003CMessageText\u003Etest_content\u003C/MessageText\u003E\u003C/QueueMessage\u003E\u003C/QueueMessagesList\u003E" }, { - "RequestUri": "http://kasoboltest.queue.core.windows.net/test-queue-186b9a2d-2db9-6a0b-f23c-b2fe3ac42f03", + "RequestUri": "https://kasoboltest.queue.core.windows.net/test-queue-186b9a2d-2db9-6a0b-f23c-b2fe3ac42f03", "RequestMethod": "DELETE", "RequestHeaders": { + "Accept": "application/xml", "Authorization": "Sanitized", - "traceparent": "00-5da478621cc71f449c6532f7f8b66cfb-3f68ec19c67bba44-00", + "traceparent": "00-76d6ea9983db734397154058e2554b77-5d16d9b344c6ba4f-00", "User-Agent": [ - "azsdk-net-Storage.Queues/12.6.0-alpha.20201116.1", - "(.NET Core 4.6.29321.03; Microsoft Windows 10.0.19042 )" + "azsdk-net-Storage.Queues/12.7.0-alpha.20210126.1", + "(.NET Framework 4.8.4250.0; Microsoft Windows 10.0.19042 )" ], "x-ms-client-request-id": "f72e1f34-63f9-ea06-8cd1-55f5b41715b1", - "x-ms-date": "Mon, 16 Nov 2020 22:31:54 GMT", + "x-ms-date": "Tue, 26 Jan 2021 18:29:20 GMT", "x-ms-return-client-request-id": "true", "x-ms-version": "2018-11-09" }, @@ -112,12 +116,12 @@ "StatusCode": 204, "ResponseHeaders": { "Content-Length": "0", - "Date": "Mon, 16 Nov 2020 22:31:54 GMT", + "Date": "Tue, 26 Jan 2021 18:29:19 GMT", "Server": [ "Windows-Azure-Queue/1.0", "Microsoft-HTTPAPI/2.0" ], - "x-ms-request-id": "1b4f3078-2003-005b-6b68-bc538f000000", + "x-ms-request-id": "65dd8b03-1003-0053-6f11-f448fc000000", "x-ms-version": "2018-11-09" }, "ResponseBody": [] @@ -125,6 +129,6 @@ ], "Variables": { "RandomSeed": "209056997", - "Storage_TestConfigDefault": "ProductionTenant\nkasoboltest\nU2FuaXRpemVk\nhttp://kasoboltest.blob.core.windows.net\nhttp://kasoboltest.file.core.windows.net\nhttp://kasoboltest.queue.core.windows.net\nhttp://kasoboltest.table.core.windows.net\n\n\n\n\nhttp://kasoboltest-secondary.blob.core.windows.net\nhttp://kasoboltest-secondary.file.core.windows.net\nhttp://kasoboltest-secondary.queue.core.windows.net\nhttp://kasoboltest-secondary.table.core.windows.net\n\nSanitized\n\n\nCloud\nBlobEndpoint=http://kasoboltest.blob.core.windows.net/;QueueEndpoint=http://kasoboltest.queue.core.windows.net/;FileEndpoint=http://kasoboltest.file.core.windows.net/;BlobSecondaryEndpoint=http://kasoboltest-secondary.blob.core.windows.net/;QueueSecondaryEndpoint=http://kasoboltest-secondary.queue.core.windows.net/;FileSecondaryEndpoint=http://kasoboltest-secondary.file.core.windows.net/;AccountName=kasoboltest;AccountKey=Kg==;\nencryptionScope" + "Storage_TestConfigDefault": "ProductionTenant\nkasoboltest\nU2FuaXRpemVk\nhttps://kasoboltest.blob.core.windows.net\nhttps://kasoboltest.file.core.windows.net\nhttps://kasoboltest.queue.core.windows.net\nhttps://kasoboltest.table.core.windows.net\n\n\n\n\nhttps://kasoboltest-secondary.blob.core.windows.net\nhttps://kasoboltest-secondary.file.core.windows.net\nhttps://kasoboltest-secondary.queue.core.windows.net\nhttps://kasoboltest-secondary.table.core.windows.net\n\nSanitized\n\n\nCloud\nBlobEndpoint=https://kasoboltest.blob.core.windows.net/;QueueEndpoint=https://kasoboltest.queue.core.windows.net/;FileEndpoint=https://kasoboltest.file.core.windows.net/;BlobSecondaryEndpoint=https://kasoboltest-secondary.blob.core.windows.net/;QueueSecondaryEndpoint=https://kasoboltest-secondary.queue.core.windows.net/;FileSecondaryEndpoint=https://kasoboltest-secondary.file.core.windows.net/;AccountName=kasoboltest;AccountKey=Kg==;\nencryptionScope" } } \ No newline at end of file diff --git a/sdk/storage/Azure.Storage.Queues/tests/SessionRecords/QueueClientTests/FailsOnInvalidQueueMessageIfNoHandlerIsProvidedAsync.json b/sdk/storage/Azure.Storage.Queues/tests/SessionRecords/QueueClientTests/FailsOnInvalidQueueMessageIfNoHandlerIsProvidedAsync.json index ba3c0397ce1a4..eabf43dcc8d22 100644 --- a/sdk/storage/Azure.Storage.Queues/tests/SessionRecords/QueueClientTests/FailsOnInvalidQueueMessageIfNoHandlerIsProvidedAsync.json +++ b/sdk/storage/Azure.Storage.Queues/tests/SessionRecords/QueueClientTests/FailsOnInvalidQueueMessageIfNoHandlerIsProvidedAsync.json @@ -1,17 +1,18 @@ { "Entries": [ { - "RequestUri": "http://kasoboltest.queue.core.windows.net/test-queue-92126722-b999-3233-5e98-9208c353523a", + "RequestUri": "https://kasoboltest.queue.core.windows.net/test-queue-92126722-b999-3233-5e98-9208c353523a", "RequestMethod": "PUT", "RequestHeaders": { + "Accept": "application/xml", "Authorization": "Sanitized", - "traceparent": "00-b01927949d0fc94fbb277535c93922a6-91ecddd6177a8d47-00", + "traceparent": "00-6cb78400ad5eca4e89db035196fed022-40333ef51bf60f42-00", "User-Agent": [ - "azsdk-net-Storage.Queues/12.6.0-alpha.20201116.1", - "(.NET Core 4.6.29321.03; Microsoft Windows 10.0.19042 )" + "azsdk-net-Storage.Queues/12.7.0-alpha.20210126.1", + "(.NET Framework 4.8.4250.0; Microsoft Windows 10.0.19042 )" ], "x-ms-client-request-id": "f14369fc-369c-5fc6-e7e6-f22fbb544d0f", - "x-ms-date": "Mon, 16 Nov 2020 22:31:55 GMT", + "x-ms-date": "Tue, 26 Jan 2021 18:29:20 GMT", "x-ms-return-client-request-id": "true", "x-ms-version": "2018-11-09" }, @@ -19,60 +20,62 @@ "StatusCode": 201, "ResponseHeaders": { "Content-Length": "0", - "Date": "Mon, 16 Nov 2020 22:31:54 GMT", + "Date": "Tue, 26 Jan 2021 18:29:19 GMT", "Server": [ "Windows-Azure-Queue/1.0", "Microsoft-HTTPAPI/2.0" ], - "x-ms-request-id": "b8aa57f6-5003-0054-1568-bcbe79000000", + "x-ms-request-id": "49e8397f-9003-000d-5e11-f4bbff000000", "x-ms-version": "2018-11-09" }, "ResponseBody": [] }, { - "RequestUri": "http://kasoboltest.queue.core.windows.net/test-queue-92126722-b999-3233-5e98-9208c353523a/messages", + "RequestUri": "https://kasoboltest.queue.core.windows.net/test-queue-92126722-b999-3233-5e98-9208c353523a/messages", "RequestMethod": "POST", "RequestHeaders": { + "Accept": "application/xml", "Authorization": "Sanitized", - "Content-Length": "68", + "Content-Length": "71", "Content-Type": "application/xml", - "traceparent": "00-af9394495bf4bf47a44b0f55c045599b-610ae585f319b44b-00", + "traceparent": "00-e2be1be0aa8698488eb08bd7731c69eb-9c82858218dc5941-00", "User-Agent": [ - "azsdk-net-Storage.Queues/12.6.0-alpha.20201116.1", - "(.NET Core 4.6.29321.03; Microsoft Windows 10.0.19042 )" + "azsdk-net-Storage.Queues/12.7.0-alpha.20210126.1", + "(.NET Framework 4.8.4250.0; Microsoft Windows 10.0.19042 )" ], "x-ms-client-request-id": "590cbb09-6010-1c9e-678e-0e4d21848b46", - "x-ms-date": "Mon, 16 Nov 2020 22:31:55 GMT", + "x-ms-date": "Tue, 26 Jan 2021 18:29:20 GMT", "x-ms-return-client-request-id": "true", "x-ms-version": "2018-11-09" }, - "RequestBody": "\u003CQueueMessage\u003E\u003CMessageText\u003Etest_content\u003C/MessageText\u003E\u003C/QueueMessage\u003E", + "RequestBody": "\uFEFF\u003CQueueMessage\u003E\u003CMessageText\u003Etest_content\u003C/MessageText\u003E\u003C/QueueMessage\u003E", "StatusCode": 201, "ResponseHeaders": { "Content-Type": "application/xml", - "Date": "Mon, 16 Nov 2020 22:31:54 GMT", + "Date": "Tue, 26 Jan 2021 18:29:19 GMT", "Server": [ "Windows-Azure-Queue/1.0", "Microsoft-HTTPAPI/2.0" ], "Transfer-Encoding": "chunked", - "x-ms-request-id": "b8aa5802-5003-0054-1e68-bcbe79000000", + "x-ms-request-id": "49e839a0-9003-000d-7b11-f4bbff000000", "x-ms-version": "2018-11-09" }, - "ResponseBody": "\uFEFF\u003C?xml version=\u00221.0\u0022 encoding=\u0022utf-8\u0022?\u003E\u003CQueueMessagesList\u003E\u003CQueueMessage\u003E\u003CMessageId\u003E1a845464-2460-4987-9d1f-9d990608c2ba\u003C/MessageId\u003E\u003CInsertionTime\u003EMon, 16 Nov 2020 22:31:55 GMT\u003C/InsertionTime\u003E\u003CExpirationTime\u003EMon, 23 Nov 2020 22:31:55 GMT\u003C/ExpirationTime\u003E\u003CPopReceipt\u003EAgAAAAMAAAAAAAAAcEWMSWi81gE=\u003C/PopReceipt\u003E\u003CTimeNextVisible\u003EMon, 16 Nov 2020 22:31:55 GMT\u003C/TimeNextVisible\u003E\u003C/QueueMessage\u003E\u003C/QueueMessagesList\u003E" + "ResponseBody": "\uFEFF\u003C?xml version=\u00221.0\u0022 encoding=\u0022utf-8\u0022?\u003E\u003CQueueMessagesList\u003E\u003CQueueMessage\u003E\u003CMessageId\u003E7ea29dbe-7a95-4a07-a7d5-549da03f91e2\u003C/MessageId\u003E\u003CInsertionTime\u003ETue, 26 Jan 2021 18:29:20 GMT\u003C/InsertionTime\u003E\u003CExpirationTime\u003ETue, 02 Feb 2021 18:29:20 GMT\u003C/ExpirationTime\u003E\u003CPopReceipt\u003EAgAAAAMAAAAAAAAAEv2kKRH01gE=\u003C/PopReceipt\u003E\u003CTimeNextVisible\u003ETue, 26 Jan 2021 18:29:20 GMT\u003C/TimeNextVisible\u003E\u003C/QueueMessage\u003E\u003C/QueueMessagesList\u003E" }, { - "RequestUri": "http://kasoboltest.queue.core.windows.net/test-queue-92126722-b999-3233-5e98-9208c353523a/messages", + "RequestUri": "https://kasoboltest.queue.core.windows.net/test-queue-92126722-b999-3233-5e98-9208c353523a/messages", "RequestMethod": "GET", "RequestHeaders": { + "Accept": "application/xml", "Authorization": "Sanitized", - "traceparent": "00-e0b5b97ff43b29469c10474850d7fa68-e9281952c043da47-00", + "traceparent": "00-458b266993a18542aec936d049178693-b1c93db7e9fbd941-00", "User-Agent": [ - "azsdk-net-Storage.Queues/12.6.0-alpha.20201116.1", - "(.NET Core 4.6.29321.03; Microsoft Windows 10.0.19042 )" + "azsdk-net-Storage.Queues/12.7.0-alpha.20210126.1", + "(.NET Framework 4.8.4250.0; Microsoft Windows 10.0.19042 )" ], "x-ms-client-request-id": "ff26c9bc-f447-f3ff-ce1a-912f5fa2ee2f", - "x-ms-date": "Mon, 16 Nov 2020 22:31:55 GMT", + "x-ms-date": "Tue, 26 Jan 2021 18:29:20 GMT", "x-ms-return-client-request-id": "true", "x-ms-version": "2018-11-09" }, @@ -81,30 +84,31 @@ "ResponseHeaders": { "Cache-Control": "no-cache", "Content-Type": "application/xml", - "Date": "Mon, 16 Nov 2020 22:31:54 GMT", + "Date": "Tue, 26 Jan 2021 18:29:20 GMT", "Server": [ "Windows-Azure-Queue/1.0", "Microsoft-HTTPAPI/2.0" ], "Transfer-Encoding": "chunked", "Vary": "Origin", - "x-ms-request-id": "2e4290a4-2003-003d-6c68-bce1d5000000", + "x-ms-request-id": "b124b8d6-b003-001a-1e11-f47b9c000000", "x-ms-version": "2018-11-09" }, - "ResponseBody": "\uFEFF\u003C?xml version=\u00221.0\u0022 encoding=\u0022utf-8\u0022?\u003E\u003CQueueMessagesList\u003E\u003CQueueMessage\u003E\u003CMessageId\u003E1a845464-2460-4987-9d1f-9d990608c2ba\u003C/MessageId\u003E\u003CInsertionTime\u003EMon, 16 Nov 2020 22:31:55 GMT\u003C/InsertionTime\u003E\u003CExpirationTime\u003EMon, 23 Nov 2020 22:31:55 GMT\u003C/ExpirationTime\u003E\u003CPopReceipt\u003EAgAAAAMAAAAAAAAAVNV3W2i81gE=\u003C/PopReceipt\u003E\u003CTimeNextVisible\u003EMon, 16 Nov 2020 22:32:25 GMT\u003C/TimeNextVisible\u003E\u003CDequeueCount\u003E1\u003C/DequeueCount\u003E\u003CMessageText\u003Etest_content\u003C/MessageText\u003E\u003C/QueueMessage\u003E\u003C/QueueMessagesList\u003E" + "ResponseBody": "\uFEFF\u003C?xml version=\u00221.0\u0022 encoding=\u0022utf-8\u0022?\u003E\u003CQueueMessagesList\u003E\u003CQueueMessage\u003E\u003CMessageId\u003E7ea29dbe-7a95-4a07-a7d5-549da03f91e2\u003C/MessageId\u003E\u003CInsertionTime\u003ETue, 26 Jan 2021 18:29:20 GMT\u003C/InsertionTime\u003E\u003CExpirationTime\u003ETue, 02 Feb 2021 18:29:20 GMT\u003C/ExpirationTime\u003E\u003CPopReceipt\u003EAgAAAAMAAAAAAAAAzGyrOxH01gE=\u003C/PopReceipt\u003E\u003CTimeNextVisible\u003ETue, 26 Jan 2021 18:29:50 GMT\u003C/TimeNextVisible\u003E\u003CDequeueCount\u003E1\u003C/DequeueCount\u003E\u003CMessageText\u003Etest_content\u003C/MessageText\u003E\u003C/QueueMessage\u003E\u003C/QueueMessagesList\u003E" }, { - "RequestUri": "http://kasoboltest.queue.core.windows.net/test-queue-92126722-b999-3233-5e98-9208c353523a", + "RequestUri": "https://kasoboltest.queue.core.windows.net/test-queue-92126722-b999-3233-5e98-9208c353523a", "RequestMethod": "DELETE", "RequestHeaders": { + "Accept": "application/xml", "Authorization": "Sanitized", - "traceparent": "00-69b9710861e4644384b8f096615eeaf7-6af111ff3c8cbe49-00", + "traceparent": "00-ee07f9e7f2434f4c95bf152ff00b077a-499bfbd37bf3f04b-00", "User-Agent": [ - "azsdk-net-Storage.Queues/12.6.0-alpha.20201116.1", - "(.NET Core 4.6.29321.03; Microsoft Windows 10.0.19042 )" + "azsdk-net-Storage.Queues/12.7.0-alpha.20210126.1", + "(.NET Framework 4.8.4250.0; Microsoft Windows 10.0.19042 )" ], "x-ms-client-request-id": "5790f2f6-8b5d-b5fe-e421-cde305e82ed7", - "x-ms-date": "Mon, 16 Nov 2020 22:31:55 GMT", + "x-ms-date": "Tue, 26 Jan 2021 18:29:20 GMT", "x-ms-return-client-request-id": "true", "x-ms-version": "2018-11-09" }, @@ -112,12 +116,12 @@ "StatusCode": 204, "ResponseHeaders": { "Content-Length": "0", - "Date": "Mon, 16 Nov 2020 22:31:54 GMT", + "Date": "Tue, 26 Jan 2021 18:29:19 GMT", "Server": [ "Windows-Azure-Queue/1.0", "Microsoft-HTTPAPI/2.0" ], - "x-ms-request-id": "b8aa5821-5003-0054-3d68-bcbe79000000", + "x-ms-request-id": "49e83a70-9003-000d-4211-f4bbff000000", "x-ms-version": "2018-11-09" }, "ResponseBody": [] @@ -125,6 +129,6 @@ ], "Variables": { "RandomSeed": "1845332121", - "Storage_TestConfigDefault": "ProductionTenant\nkasoboltest\nU2FuaXRpemVk\nhttp://kasoboltest.blob.core.windows.net\nhttp://kasoboltest.file.core.windows.net\nhttp://kasoboltest.queue.core.windows.net\nhttp://kasoboltest.table.core.windows.net\n\n\n\n\nhttp://kasoboltest-secondary.blob.core.windows.net\nhttp://kasoboltest-secondary.file.core.windows.net\nhttp://kasoboltest-secondary.queue.core.windows.net\nhttp://kasoboltest-secondary.table.core.windows.net\n\nSanitized\n\n\nCloud\nBlobEndpoint=http://kasoboltest.blob.core.windows.net/;QueueEndpoint=http://kasoboltest.queue.core.windows.net/;FileEndpoint=http://kasoboltest.file.core.windows.net/;BlobSecondaryEndpoint=http://kasoboltest-secondary.blob.core.windows.net/;QueueSecondaryEndpoint=http://kasoboltest-secondary.queue.core.windows.net/;FileSecondaryEndpoint=http://kasoboltest-secondary.file.core.windows.net/;AccountName=kasoboltest;AccountKey=Kg==;\nencryptionScope" + "Storage_TestConfigDefault": "ProductionTenant\nkasoboltest\nU2FuaXRpemVk\nhttps://kasoboltest.blob.core.windows.net\nhttps://kasoboltest.file.core.windows.net\nhttps://kasoboltest.queue.core.windows.net\nhttps://kasoboltest.table.core.windows.net\n\n\n\n\nhttps://kasoboltest-secondary.blob.core.windows.net\nhttps://kasoboltest-secondary.file.core.windows.net\nhttps://kasoboltest-secondary.queue.core.windows.net\nhttps://kasoboltest-secondary.table.core.windows.net\n\nSanitized\n\n\nCloud\nBlobEndpoint=https://kasoboltest.blob.core.windows.net/;QueueEndpoint=https://kasoboltest.queue.core.windows.net/;FileEndpoint=https://kasoboltest.file.core.windows.net/;BlobSecondaryEndpoint=https://kasoboltest-secondary.blob.core.windows.net/;QueueSecondaryEndpoint=https://kasoboltest-secondary.queue.core.windows.net/;FileSecondaryEndpoint=https://kasoboltest-secondary.file.core.windows.net/;AccountName=kasoboltest;AccountKey=Kg==;\nencryptionScope" } } \ No newline at end of file From 4d5eeacf5fb12be72be2cf365d25696fe690af8a Mon Sep 17 00:00:00 2001 From: Kamil Sobol Date: Tue, 26 Jan 2021 10:45:41 -0800 Subject: [PATCH 11/27] hack core temporarily. --- .../Shared/SyncAsyncEventHandlerExtensions.cs | 124 ++++++++++ sdk/core/Azure.Core/src/SyncAsyncEventArgs.cs | 95 ++++++++ .../Azure.Core/src/SyncAsyncEventHandler.cs | 218 ++++++++++++++++++ .../src/Azure.Storage.Common.csproj | 5 +- 4 files changed, 440 insertions(+), 2 deletions(-) create mode 100644 sdk/core/Azure.Core/src/Shared/SyncAsyncEventHandlerExtensions.cs create mode 100644 sdk/core/Azure.Core/src/SyncAsyncEventArgs.cs create mode 100644 sdk/core/Azure.Core/src/SyncAsyncEventHandler.cs diff --git a/sdk/core/Azure.Core/src/Shared/SyncAsyncEventHandlerExtensions.cs b/sdk/core/Azure.Core/src/Shared/SyncAsyncEventHandlerExtensions.cs new file mode 100644 index 0000000000000..1835004d7350e --- /dev/null +++ b/sdk/core/Azure.Core/src/Shared/SyncAsyncEventHandlerExtensions.cs @@ -0,0 +1,124 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System; +using System.Collections.Generic; +using System.Threading.Tasks; +using Azure.Core.Pipeline; + +// TODO (kasobol-msft) This is borrowed from https://github.com/Azure/azure-sdk-for-net/pull/18170. +namespace Azure.Core +{ + /// + /// Extensions for raising + /// events. + /// + internal static class SyncAsyncEventHandlerExtensions + { + /// + /// Raise an + /// event by executing each of the handlers sequentially (to avoid + /// introducing accidental parallelism in customer code) and collecting + /// any exceptions. + /// + /// Type of the event arguments. + /// The event's delegate. + /// + /// An instance that contains the + /// event data. + /// + /// + /// The name of the type declaring the event to construct a helpful + /// exception message and distributed tracing span. + /// + /// + /// The name of the event to construct a helpful exception message and + /// distributed tracing span. + /// + /// + /// Client diagnostics to wrap all the handlers in a new distributed + /// tracing span. + /// + /// + /// A task that represents running all of the event's handlers. + /// + /// + /// An exception was thrown during the execution of at least one of the + /// event's handlers. + /// + /// + /// Thrown when , , + /// , or + /// are null. + /// + /// + /// Thrown when or + /// are empty. + /// + public static async Task RaiseAsync( + this SyncAsyncEventHandler eventHandler, + T e, + string declaringTypeName, + string eventName, + ClientDiagnostics clientDiagnostics) + where T : SyncAsyncEventArgs + { + Argument.AssertNotNull(e, nameof(e)); + Argument.AssertNotNullOrEmpty(declaringTypeName, nameof(declaringTypeName)); + Argument.AssertNotNullOrEmpty(eventName, nameof(eventName)); + Argument.AssertNotNull(clientDiagnostics, nameof(clientDiagnostics)); + + // Get the invocation list, but return early if there's no work + if (eventHandler == null) { return; } + Delegate[] handlers = eventHandler.GetInvocationList(); + if (handlers == null || handlers.Length == 0) { return; } + + // Wrap handler invocation in a distributed tracing span so it's + // easy for customers to track and measure + string eventFullName = declaringTypeName + "." + eventName; + using DiagnosticScope scope = clientDiagnostics.CreateScope(eventFullName); + scope.Start(); + try + { + // Collect any exceptions raised by handlers + List failures = null; + + // Raise the handlers sequentially so we don't introduce any + // unintentional parallelism in customer code + foreach (Delegate handler in handlers) + { + SyncAsyncEventHandler azureHandler = (SyncAsyncEventHandler)handler; + try + { + Task runHandlerTask = azureHandler(e); + // We can consider logging something when e.RunSynchronously + // is true, but runHandlerTask.IsComplete is false. + // (We're not bother to check our tests because + // EnsureCompleted on the code path that raised the + // event will catch it for us.) + await runHandlerTask.ConfigureAwait(false); + } + catch (Exception ex) + { + failures ??= new List(); + failures.Add(ex); + } + } + + // Wrap any exceptions in an AggregateException + if (failures?.Count > 0) + { + // Include the event name in the exception for easier debugging + throw new AggregateException( + "Unhandled exception(s) thrown when raising the " + eventFullName + " event.", + failures); + } + } + catch (Exception ex) + { + scope.Failed(ex); + throw; + } + } + } +} diff --git a/sdk/core/Azure.Core/src/SyncAsyncEventArgs.cs b/sdk/core/Azure.Core/src/SyncAsyncEventArgs.cs new file mode 100644 index 0000000000000..d20a9a46158ca --- /dev/null +++ b/sdk/core/Azure.Core/src/SyncAsyncEventArgs.cs @@ -0,0 +1,95 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System; +using System.Threading; + +// TODO (kasobol-msft) This is borrowed from https://github.com/Azure/azure-sdk-for-net/pull/18170. +namespace Azure +{ + /// + /// Provides data for + /// events that can be invoked either synchronously or asynchronously. + /// + public class SyncAsyncEventArgs : EventArgs + { + /// + /// Gets a value indicating whether the event handler was invoked + /// synchronously or asynchronously. Please see + /// for more details. + /// + /// + /// + /// The same + /// event can be raised from both synchronous and asynchronous code + /// paths depending on whether you're calling sync or async methods on + /// a client. If you write an async handler but raise it from a sync + /// method, the handler will be doing sync-over-async and may cause + /// ThreadPool starvation. See + /// + /// Diagnosing .NET Core ThreadPool Starvation with PerfView for + /// a detailed explanation of how that can cause ThreadPool starvation + /// and serious performance problems. + /// + /// + /// You can use this property to check + /// how the event is being raised and implement your handler + /// accordingly. Here's an example handler that's safe to invoke from + /// both sync and async code paths. + /// + /// var client = new AlarmClient(); + /// client.Ring += async (SyncAsyncEventArgs e) => + /// { + /// if (e.RunSynchronously) + /// { + /// Console.WriteLine("Wake up!"); + /// } + /// else + /// { + /// await Console.Out.WriteLineAsync("Wake up!"); + /// } + /// }; + /// + /// client.Snooze(); // sync call that blocks + /// await client.SnoozeAsync(); // async call that doesn't block + /// + /// + /// + public bool RunSynchronously { get; } + + /// + /// Gets a cancellation token related to the original operation that + /// raised the event. It's important for your handler to pass this + /// token along to any asynchronous or long-running synchronous + /// operations that take a token so cancellation (via something like + /// + /// new CancellationTokenSource(TimeSpan.FromSeconds(10)).Token + /// + /// for example) will correctly propagate. + /// + public CancellationToken CancellationToken { get; } + + /// + /// Initializes a new instance of the + /// class. + /// + /// + /// A value indicating whether the event handler was invoked + /// synchronously or asynchronously. Please see + /// for more details. + /// + /// + /// A cancellation token related to the original operation that raised + /// the event. It's important for your handler to pass this token + /// along to any asynchronous or long-running synchronous operations + /// that take a token so cancellation will correctly propagate. The + /// default value is . + /// + public SyncAsyncEventArgs(bool runSynchronously, CancellationToken cancellationToken = default) + : base() + { + RunSynchronously = runSynchronously; + CancellationToken = cancellationToken; + } + } +} diff --git a/sdk/core/Azure.Core/src/SyncAsyncEventHandler.cs b/sdk/core/Azure.Core/src/SyncAsyncEventHandler.cs new file mode 100644 index 0000000000000..7712c81dc102b --- /dev/null +++ b/sdk/core/Azure.Core/src/SyncAsyncEventHandler.cs @@ -0,0 +1,218 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System; +using System.Threading.Tasks; + +// TODO (kasobol-msft) This is borrowed from https://github.com/Azure/azure-sdk-for-net/pull/18170. +namespace Azure.Core +{ + /// + /// Represents a method that can handle an event and execute either + /// synchronously or asynchronously. + /// + /// + /// Type of the event arguments deriving or equal to + /// . + /// + /// + /// An instance that contains the event + /// data. + /// + /// + /// A task that represents the handler. You can return + /// if implementing a sync handler. + /// Please see the Remarks section for more details. + /// + /// + /// + /// If you're using the synchronous, blocking methods of a client (i.e., + /// methods without an Async suffix), they will raise events that require + /// handlers to execute synchronously as well. Even though the signature + /// of your handler returns a , you should write regular + /// sync code that blocks and return when + /// finished. + /// + /// var client = new AlarmClient(); + /// client.Ring += (SyncAsyncEventArgs e) => + /// { + /// Console.WriteLine("Wake up!"); + /// return Task.CompletedTask; + /// }; + /// + /// client.Snooze(); + /// + /// If you need to call an async method from a synchronous event handler, + /// you have two options. You can use to + /// queue a task for execution on the ThreadPool without waiting on it to + /// complete. This "fire and forget" approach may not run before your + /// handler finishes executing. Be sure to understand + /// + /// exception handling in the Task Parallel Library to avoid + /// unhandled exceptions tearing down your process. If you absolutely need + /// the async method to execute before returning from your handler, you can + /// call myAsyncTask.GetAwaiter().GetResult(). Please be aware + /// this may cause ThreadPool starvation. See the sync-over-async note in + /// Remarks for more details. + /// + /// + /// If you're using the asynchronous, non-blocking methods of a client + /// (i.e., methods with an Async suffix), they will raise events that + /// expect handlers to execute asynchronously. + /// + /// var client = new AlarmClient(); + /// client.Ring += async (SyncAsyncEventArgs e) => + /// { + /// await Console.Out.WriteLineAsync("Wake up!"); + /// }; + /// + /// await client.SnoozeAsync(); + /// + /// + /// + /// The same event can be raised from both synchronous and asynchronous + /// code paths depending on whether you're calling sync or async methods + /// on a client. If you write an async handler but raise it from a sync + /// method, the handler will be doing sync-over-async and may cause + /// ThreadPool starvation. See the note in Remarks for more details. You + /// should use the + /// property to check how the event is being raised and implement your + /// handler accordingly. Here's an example handler that's safe to invoke + /// from both sync and async code paths. + /// + /// var client = new AlarmClient(); + /// client.Ring += async (SyncAsyncEventArgs e) => + /// { + /// if (e.RunSynchronously) + /// { + /// Console.WriteLine("Wake up!"); + /// } + /// else + /// { + /// await Console.Out.WriteLineAsync("Wake up!"); + /// } + /// }; + /// + /// client.Snooze(); // sync call that blocks + /// await client.SnoozeAsync(); // async call that doesn't block + /// + /// + /// + /// + /// + /// + /// Any exceptions thrown by an event handler will be wrapped in a single + /// AggregateException and thrown from the code that raised the event. You + /// can check the property + /// to see the original exceptions thrown by your event handlers. + /// AggregateException also provides + /// + /// a number of helpful methods like + /// and + /// to make + /// complex failures easier to work with. + /// + /// var client = new AlarmClient(); + /// client.Ring += (SyncAsyncEventArgs e) => + /// throw new InvalidOperationException("Alarm unplugged."); + /// + /// try + /// { + /// client.Snooze(); + /// } + /// catch (AggregateException ex) + /// { + /// ex.Handle(e => e is InvalidOperationException); + /// Console.WriteLine("Please switch to your backup alarm."); + /// } + /// + /// + /// + /// + /// Most Azure client libraries for .NET offer both synchronous and + /// asynchronous methods for calling Azure services. You can distinguish + /// the asynchronous methods by their Async suffix. For example, + /// BlobClient.Download and BlobClient.DownloadAsync make the same + /// underlying REST call and only differ in whether they block. We + /// recommend using our async methods for new applications, but there are + /// perfectly valid cases for using sync methods as well. These dual + /// method invocation semantics address the needs of our customers, but + /// require a little extra care when writing event handlers. + /// + /// + /// The SyncAsyncEventHandler is a delegate used by events in Azure client + /// libraries to represent an event handler that can be invoked from either + /// sync or async code paths. It takes event arguments deriving from + /// that contain important information for + /// writing your event handler: + /// + /// + /// + /// is a cancellation + /// token related to the original operation that raised the event. It's + /// important for your handler to pass this token along to any asynchronous + /// or long-running synchronous operations that take a token so cancellation + /// (via something like + /// new CancellationTokenSource(TimeSpan.FromSeconds(10)).Token, + /// for example) will correctly propagate. + /// + /// + /// + /// + /// is a flag indicating + /// whether your handler was invoked synchronously or asynchronously. If + /// you're calling sync methods on your client, you should use sync methods + /// to implement your event handler (you can return + /// ). If you're calling async methods on + /// your client, you should use async methods where possible to implement + /// your event handler. If you're not in control of how the client will be + /// used or want to write safer code, you should check the + /// property and call + /// either sync or async methods as directed. + /// + /// + /// + /// + /// Most events will customize the event data by deriving from + /// and including details about what + /// triggered the event or providing options to react. Many times this + /// will include a reference to the client that raised the event in case + /// you need it for additional processing. + /// + /// + /// + /// + /// + /// When an event using SyncAsyncEventHandler is raised, the handlers will + /// be executed sequentially to avoid introducing any unintended + /// parallelism. The event handlers will finish before returning control + /// to the code path raising the event. This means blocking for events + /// raised synchronously and waiting for the returned to + /// complete for events raised asynchronously. Any exceptions thrown from + /// a handler will be wrapped in a single . + /// Finally, a + /// + /// distributed tracing span is wrapped around your handlers using + /// the event name so you can see how long your handlers took to run, + /// whether they made other calls to Azure services, and details about any + /// exceptions that were thrown. + /// + /// + /// Executing asynchronous code from a sync code path is commonly referred + /// to as sync-over-async because you're getting sync behavior but still + /// invoking all the async machinery. See + /// + /// Diagnosing.NET Core ThreadPool Starvation with PerfView + /// for a detailed explanation of how that can cause serious performance + /// problems. We recommend you use the + /// flag to avoid + /// ThreadPool starvation. + /// + /// + public delegate Task SyncAsyncEventHandler(T e) + where T : SyncAsyncEventArgs; + + // NOTE: You should always use SyncAsyncEventHandlerExtensions.RaiseAsync + // in Azure.Core's shared source to ensure consistent event handling + // semantics. +} diff --git a/sdk/storage/Azure.Storage.Common/src/Azure.Storage.Common.csproj b/sdk/storage/Azure.Storage.Common/src/Azure.Storage.Common.csproj index c559c97807f6e..89dae5ffc379f 100644 --- a/sdk/storage/Azure.Storage.Common/src/Azure.Storage.Common.csproj +++ b/sdk/storage/Azure.Storage.Common/src/Azure.Storage.Common.csproj @@ -1,4 +1,4 @@ - + $(RequiredTargetFrameworks) @@ -18,7 +18,8 @@ Azure.Storage - + + From 451c330d96e503bfbea595e995b5215f162d699d Mon Sep 17 00:00:00 2001 From: Kamil Sobol Date: Tue, 26 Jan 2021 11:52:00 -0800 Subject: [PATCH 12/27] use event hander from core. --- .../Azure.Storage.Queues.netstandard2.0.cs | 11 +-- .../src/Azure.Storage.Queues.csproj | 1 + .../src/InvalidMessageEventArgs.cs | 95 +++++++++++++++++++ .../src/InvalidQueueMessageEventArgs.cs | 58 ----------- .../Azure.Storage.Queues/src/QueueClient.cs | 75 +++++++-------- .../src/QueueClientConfiguration.cs | 7 +- .../src/QueueClientOptions.cs | 17 ++++ .../src/QueueServiceClient.cs | 7 +- .../tests/QueueClientTests.cs | 5 - .../tests/QueueTestBase.cs | 4 +- 10 files changed, 164 insertions(+), 116 deletions(-) create mode 100644 sdk/storage/Azure.Storage.Queues/src/InvalidMessageEventArgs.cs delete mode 100644 sdk/storage/Azure.Storage.Queues/src/InvalidQueueMessageEventArgs.cs diff --git a/sdk/storage/Azure.Storage.Queues/api/Azure.Storage.Queues.netstandard2.0.cs b/sdk/storage/Azure.Storage.Queues/api/Azure.Storage.Queues.netstandard2.0.cs index c4e48e5e5e025..917818b840316 100644 --- a/sdk/storage/Azure.Storage.Queues/api/Azure.Storage.Queues.netstandard2.0.cs +++ b/sdk/storage/Azure.Storage.Queues/api/Azure.Storage.Queues.netstandard2.0.cs @@ -1,12 +1,11 @@ namespace Azure.Storage.Queues { - public partial class InvalidQueueMessageEventArgs : System.EventArgs + public partial class InvalidMessageEventArgs : Azure.SyncAsyncEventArgs { - public InvalidQueueMessageEventArgs(Azure.Storage.Queues.QueueClient sender, Azure.Storage.Queues.Models.PeekedMessage message, System.Threading.CancellationToken cancellationToken) { } - public InvalidQueueMessageEventArgs(Azure.Storage.Queues.QueueClient sender, Azure.Storage.Queues.Models.QueueMessage message, System.Threading.CancellationToken cancellationToken) { } - public System.Threading.CancellationToken CancellationToken { get { throw null; } } + public InvalidMessageEventArgs(Azure.Storage.Queues.QueueClient queue, Azure.Storage.Queues.Models.PeekedMessage message, bool runSynchronously, System.Threading.CancellationToken cancellationToken) : base (default(bool), default(System.Threading.CancellationToken)) { } + public InvalidMessageEventArgs(Azure.Storage.Queues.QueueClient queue, Azure.Storage.Queues.Models.QueueMessage message, bool runSynchronously, System.Threading.CancellationToken cancellationToken) : base (default(bool), default(System.Threading.CancellationToken)) { } public object Message { get { throw null; } } - public Azure.Storage.Queues.QueueClient Sender { get { throw null; } } + public Azure.Storage.Queues.QueueClient Queue { get { throw null; } } } public partial class QueueClient { @@ -24,7 +23,6 @@ public QueueClient(System.Uri queueUri, Azure.Storage.StorageSharedKeyCredential protected virtual System.Uri MessagesUri { get { throw null; } } public virtual string Name { get { throw null; } } public virtual System.Uri Uri { get { throw null; } } - public event System.Func InvalidQueueMessageAsync { add { } remove { } } public virtual Azure.Response ClearMessages(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task ClearMessagesAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Response Create(System.Collections.Generic.IDictionary metadata = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } @@ -81,6 +79,7 @@ public QueueClientOptions(Azure.Storage.Queues.QueueClientOptions.ServiceVersion public System.Uri GeoRedundantSecondaryUri { get { throw null; } set { } } public Azure.Storage.Queues.QueueMessageEncoding MessageEncoding { get { throw null; } set { } } public Azure.Storage.Queues.QueueClientOptions.ServiceVersion Version { get { throw null; } } + public event Azure.Core.SyncAsyncEventHandler OnInvalidMessage { add { } remove { } } public enum ServiceVersion { V2019_02_02 = 1, diff --git a/sdk/storage/Azure.Storage.Queues/src/Azure.Storage.Queues.csproj b/sdk/storage/Azure.Storage.Queues/src/Azure.Storage.Queues.csproj index 442639c8e4160..4867ce8e81e53 100644 --- a/sdk/storage/Azure.Storage.Queues/src/Azure.Storage.Queues.csproj +++ b/sdk/storage/Azure.Storage.Queues/src/Azure.Storage.Queues.csproj @@ -36,6 +36,7 @@ + diff --git a/sdk/storage/Azure.Storage.Queues/src/InvalidMessageEventArgs.cs b/sdk/storage/Azure.Storage.Queues/src/InvalidMessageEventArgs.cs new file mode 100644 index 0000000000000..6f8c895131391 --- /dev/null +++ b/sdk/storage/Azure.Storage.Queues/src/InvalidMessageEventArgs.cs @@ -0,0 +1,95 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System.Threading; +using Azure.Core; +using Azure.Storage.Queues.Models; + +namespace Azure.Storage.Queues +{ + /// + /// Contains information about invalid message. + /// See also . + /// + public class InvalidMessageEventArgs : SyncAsyncEventArgs + { + /// + /// Gets the that has received invalid message. + /// + public QueueClient Queue { get; } + + /// + /// Gets the invalid message which can be either or . + /// The body of the message is as received, i.e. no decoding is attempted. + /// + public object Message { get; } + + /// + /// Initializes a new instance of the . + /// + /// The that has received invalid message. + /// The invalid message. + /// + /// A value indicating whether the event handler was invoked + /// synchronously or asynchronously. Please see + /// for more details. + /// + /// + /// A cancellation token related to the original operation that raised + /// the event. It's important for your handler to pass this token + /// along to any asynchronous or long-running synchronous operations + /// that take a token so cancellation will correctly propagate. The + /// default value is . + /// + /// + /// Thrown if or + /// are null. + /// + public InvalidMessageEventArgs( + QueueClient queue, + QueueMessage message, + bool runSynchronously, + CancellationToken cancellationToken) + : base(runSynchronously, cancellationToken) + { + Argument.AssertNotNull(queue, nameof(queue)); + Argument.AssertNotNull(message, nameof(message)); + Queue = queue; + Message = message; + } + + /// + /// Initializes a new instance of the . + /// + /// The that has received invalid message. + /// The invalid message. + /// + /// A value indicating whether the event handler was invoked + /// synchronously or asynchronously. Please see + /// for more details. + /// + /// + /// A cancellation token related to the original operation that raised + /// the event. It's important for your handler to pass this token + /// along to any asynchronous or long-running synchronous operations + /// that take a token so cancellation will correctly propagate. The + /// default value is . + /// + /// + /// Thrown if or + /// are null. + /// + public InvalidMessageEventArgs( + QueueClient queue, + PeekedMessage message, + bool runSynchronously, + CancellationToken cancellationToken) + : base(runSynchronously, cancellationToken) + { + Argument.AssertNotNull(queue, nameof(queue)); + Argument.AssertNotNull(message, nameof(message)); + Queue = queue; + Message = message; + } + } +} diff --git a/sdk/storage/Azure.Storage.Queues/src/InvalidQueueMessageEventArgs.cs b/sdk/storage/Azure.Storage.Queues/src/InvalidQueueMessageEventArgs.cs deleted file mode 100644 index 3a15afe117354..0000000000000 --- a/sdk/storage/Azure.Storage.Queues/src/InvalidQueueMessageEventArgs.cs +++ /dev/null @@ -1,58 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -using System; -using System.Threading; -using Azure.Storage.Queues.Models; - -namespace Azure.Storage.Queues -{ - /// - /// Contains information about invalid message. - /// See also . - /// - public class InvalidQueueMessageEventArgs : EventArgs - { - /// - /// Gets the that has received invalid message. - /// - public QueueClient Sender { get; } - - /// - /// Gets the invalid message which can be either or . - /// The body of the message is as received, i.e. no decoding is attempted. - /// - public object Message { get; } - - /// - /// A instance to signal the request to cancel the operation. - /// - public CancellationToken CancellationToken { get; } - - /// - /// Initializes a new instance of the . - /// - /// The that has received invalid message. - /// The invalid message - /// A instance to signal the request to cancel the operation. - public InvalidQueueMessageEventArgs(QueueClient sender, QueueMessage message, CancellationToken cancellationToken) - { - Sender = sender; - Message = message; - CancellationToken = cancellationToken; - } - - /// - /// Initializes a new instance of the . - /// - /// The that has received invalid message. - /// The invalid message - /// A instance to signal the request to cancel the operation. - public InvalidQueueMessageEventArgs(QueueClient sender, PeekedMessage message, CancellationToken cancellationToken) - { - Sender = sender; - Message = message; - CancellationToken = cancellationToken; - } - } -} diff --git a/sdk/storage/Azure.Storage.Queues/src/QueueClient.cs b/sdk/storage/Azure.Storage.Queues/src/QueueClient.cs index 2a6d2ad688c56..4fbdbb5e42c35 100644 --- a/sdk/storage/Azure.Storage.Queues/src/QueueClient.cs +++ b/sdk/storage/Azure.Storage.Queues/src/QueueClient.cs @@ -119,29 +119,6 @@ public virtual string AccountName /// private string _name; - /// - /// Optional. Performs the tasks needed when an invalid message is received or peaked from the queue. - /// - /// Invalid message can be received or peaked when is expecting certain - /// but there's another producer that is not encoding messages in expected way. I.e. the queue contains messages with different encoding. - /// - /// contains that has received invalid message as well as the message - /// which can be either or with raw body, i.e. no decoding will be attempted so that - /// body can be inspected as has been received from the queue. - /// - /// The won't attempt to remove invalid message from the queue. Therefore such handling should be included into - /// the event handler itself. - /// -#pragma warning disable AZC0002 // DO ensure all service methods, both asynchronous and synchronous, take an optional CancellationToken parameter called cancellationToken. -#pragma warning disable AZC0003 // DO make service methods virtual. -#pragma warning disable AZC0004 // DO provide both asynchronous and synchronous variants for all service methods. -#pragma warning disable AZC0015 // Unexpected client method return type. - public event Func InvalidQueueMessageAsync; -#pragma warning restore AZC0015 // Unexpected client method return type. -#pragma warning restore AZC0004 // DO provide both asynchronous and synchronous variants for all service methods. -#pragma warning restore AZC0003 // DO make service methods virtual. -#pragma warning restore AZC0002 // DO ensure all service methods, both asynchronous and synchronous, take an optional CancellationToken parameter called cancellationToken. - /// /// Gets the name of the queue. /// @@ -229,7 +206,8 @@ public QueueClient(string connectionString, string queueName, QueueClientOptions clientDiagnostics: new ClientDiagnostics(options), version: options.Version, clientSideEncryption: QueueClientSideEncryptionOptions.CloneFrom(options._clientSideEncryptionOptions), - messageEncoding: options.MessageEncoding); + messageEncoding: options.MessageEncoding, + invalidMessageHandler: options.GetInvalidMessageHandlers()); (QueueRestClient queueRestClient, MessagesRestClient messagesRestClient, MessageIdRestClient messageIdRestClient) = BuildRestClients(); _queueRestClient = queueRestClient; @@ -365,7 +343,8 @@ internal QueueClient( clientDiagnostics: new ClientDiagnostics(options), version: options.Version, clientSideEncryption: QueueClientSideEncryptionOptions.CloneFrom(options._clientSideEncryptionOptions), - messageEncoding: options.MessageEncoding); + messageEncoding: options.MessageEncoding, + invalidMessageHandler: options.GetInvalidMessageHandlers()); (QueueRestClient queueRestClient, MessagesRestClient messagesRestClient, MessageIdRestClient messageIdRestClient) = BuildRestClients(); _queueRestClient = queueRestClient; @@ -2225,9 +2204,9 @@ private async Task> ReceiveMessagesInternal( } else { QueueMessage[] queueMessages; - if (InvalidQueueMessageAsync != null) + if (ClientConfiguration.InvalidMessageHandler != null) { - queueMessages = ToQueueMessagesWithInvalidMessageHandling(response.Value, cancellationToken); + queueMessages = await ToQueueMessagesWithInvalidMessageHandling(response.Value, async, cancellationToken).ConfigureAwait(false); } else { queueMessages = response.Value.Select(x => QueueMessage.ToQueueMessage(x, ClientConfiguration.MessageEncoding)).ToArray(); @@ -2260,8 +2239,9 @@ private async Task> ReceiveMessagesInternal( } } - private QueueMessage[] ToQueueMessagesWithInvalidMessageHandling( + private async Task ToQueueMessagesWithInvalidMessageHandling( IEnumerable dequeuedMessageItems, + bool async, CancellationToken cancellationToken) { List queueMessages = new List(); @@ -2274,11 +2254,17 @@ private QueueMessage[] ToQueueMessagesWithInvalidMessageHandling( } catch (FormatException) { - _ = Task.Run(() => InvalidQueueMessageAsync.Invoke( - new InvalidQueueMessageEventArgs( - this, - QueueMessage.ToQueueMessage(dequeuedMessageItem, QueueMessageEncoding.None), - cancellationToken)), cancellationToken); +#pragma warning disable AZC0110 // DO NOT use await keyword in possibly synchronous scope. + await ClientConfiguration.InvalidMessageHandler.RaiseAsync( + new InvalidMessageEventArgs( + queue: this, + message: QueueMessage.ToQueueMessage(dequeuedMessageItem, QueueMessageEncoding.None), + runSynchronously: !async, + cancellationToken: cancellationToken), + nameof(QueueClientOptions), + nameof(QueueClientOptions.OnInvalidMessage), + ClientConfiguration.ClientDiagnostics).ConfigureAwait(false); +#pragma warning restore AZC0110 // DO NOT use await keyword in possibly synchronous scope. } } @@ -2577,9 +2563,9 @@ private async Task> PeekMessagesInternal( else { PeekedMessage[] peekedMessages; - if (InvalidQueueMessageAsync != null) + if (ClientConfiguration.InvalidMessageHandler != null) { - peekedMessages = ToPeekedMessagesWithInvalidMessageHandling(response.Value, cancellationToken); + peekedMessages = await ToPeekedMessagesWithInvalidMessageHandling(response.Value, async, cancellationToken).ConfigureAwait(false); } else { @@ -2613,8 +2599,9 @@ private async Task> PeekMessagesInternal( } } - private PeekedMessage[] ToPeekedMessagesWithInvalidMessageHandling( + private async Task ToPeekedMessagesWithInvalidMessageHandling( IEnumerable peekedMessageItems, + bool async, CancellationToken cancellationToken) { List peekedMessages = new List(); @@ -2627,11 +2614,17 @@ private PeekedMessage[] ToPeekedMessagesWithInvalidMessageHandling( } catch (FormatException) { - _ = Task.Run(() => InvalidQueueMessageAsync.Invoke( - new InvalidQueueMessageEventArgs( - this, - PeekedMessage.ToPeekedMessage(peekedMessageItem, QueueMessageEncoding.None), - cancellationToken)), cancellationToken); +#pragma warning disable AZC0110 // DO NOT use await keyword in possibly synchronous scope. + await ClientConfiguration.InvalidMessageHandler.RaiseAsync( + new InvalidMessageEventArgs( + queue: this, + message: PeekedMessage.ToPeekedMessage(peekedMessageItem, QueueMessageEncoding.None), + runSynchronously: !async, + cancellationToken: cancellationToken), + nameof(QueueClientOptions), + nameof(QueueClientOptions.OnInvalidMessage), + ClientConfiguration.ClientDiagnostics).ConfigureAwait(false); +#pragma warning restore AZC0110 // DO NOT use await keyword in possibly synchronous scope. } } diff --git a/sdk/storage/Azure.Storage.Queues/src/QueueClientConfiguration.cs b/sdk/storage/Azure.Storage.Queues/src/QueueClientConfiguration.cs index 158e89f755bc1..2491a6f2443e7 100644 --- a/sdk/storage/Azure.Storage.Queues/src/QueueClientConfiguration.cs +++ b/sdk/storage/Azure.Storage.Queues/src/QueueClientConfiguration.cs @@ -1,6 +1,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. +using Azure.Core; using Azure.Core.Pipeline; using Azure.Storage.Queues.Specialized; using Azure.Storage.Shared; @@ -15,18 +16,22 @@ internal class QueueClientConfiguration : StorageClientConfiguration public QueueMessageEncoding MessageEncoding { get; internal set; } + public SyncAsyncEventHandler InvalidMessageHandler { get; internal set; } + public QueueClientConfiguration( HttpPipeline pipeline, StorageSharedKeyCredential sharedKeyCredential, ClientDiagnostics clientDiagnostics, QueueClientOptions.ServiceVersion version, QueueClientSideEncryptionOptions clientSideEncryption, - QueueMessageEncoding messageEncoding) + QueueMessageEncoding messageEncoding, + SyncAsyncEventHandler invalidMessageHandler) : base(pipeline, sharedKeyCredential, clientDiagnostics) { Version = version; ClientSideEncryption = clientSideEncryption; MessageEncoding = messageEncoding; + InvalidMessageHandler = invalidMessageHandler; } } } diff --git a/sdk/storage/Azure.Storage.Queues/src/QueueClientOptions.cs b/sdk/storage/Azure.Storage.Queues/src/QueueClientOptions.cs index 0279f9c58770a..5430d5d644773 100644 --- a/sdk/storage/Azure.Storage.Queues/src/QueueClientOptions.cs +++ b/sdk/storage/Azure.Storage.Queues/src/QueueClientOptions.cs @@ -113,6 +113,23 @@ public QueueClientOptions(ServiceVersion version = LatestVersion) /// public QueueMessageEncoding MessageEncoding { get; set; } = QueueMessageEncoding.None; + /// + /// Optional. Performs the tasks needed when an invalid message is received or peaked from the queue. + /// + /// Invalid message can be received or peaked when is expecting certain + /// but there's another producer that is not encoding messages in expected way. I.e. the queue contains messages with different encoding. + /// + /// contains that has received invalid message as well as the message + /// which can be either or with raw body, i.e. no decoding will be attempted so that + /// body can be inspected as has been received from the queue. + /// + /// The won't attempt to remove invalid message from the queue. Therefore such handling should be included into + /// the event handler itself. + /// + public event SyncAsyncEventHandler OnInvalidMessage; + + internal SyncAsyncEventHandler GetInvalidMessageHandlers() => OnInvalidMessage; + #region Advanced Options internal ClientSideEncryptionOptions _clientSideEncryptionOptions; #endregion diff --git a/sdk/storage/Azure.Storage.Queues/src/QueueServiceClient.cs b/sdk/storage/Azure.Storage.Queues/src/QueueServiceClient.cs index 172fe630bc44e..e1d637b7cbf5a 100644 --- a/sdk/storage/Azure.Storage.Queues/src/QueueServiceClient.cs +++ b/sdk/storage/Azure.Storage.Queues/src/QueueServiceClient.cs @@ -8,7 +8,6 @@ using System.Threading.Tasks; using Azure.Core; using Azure.Core.Pipeline; -using Azure.Storage.Cryptography; using Azure.Storage.Queues.Models; using Azure.Storage.Queues.Specialized; using Azure.Storage.Sas; @@ -132,7 +131,8 @@ public QueueServiceClient(string connectionString, QueueClientOptions options) clientDiagnostics: new ClientDiagnostics(options), version: options.Version, clientSideEncryption: QueueClientSideEncryptionOptions.CloneFrom(options._clientSideEncryptionOptions), - messageEncoding: options.MessageEncoding); + messageEncoding: options.MessageEncoding, + invalidMessageHandler: options.GetInvalidMessageHandlers()); _serviceRestClient = BuildServiceRestClient(); } @@ -258,7 +258,8 @@ internal QueueServiceClient( clientDiagnostics: new ClientDiagnostics(options), version: options.Version, clientSideEncryption: QueueClientSideEncryptionOptions.CloneFrom(options._clientSideEncryptionOptions), - messageEncoding: options.MessageEncoding); + messageEncoding: options.MessageEncoding, + invalidMessageHandler: options.GetInvalidMessageHandlers()); _serviceRestClient = BuildServiceRestClient(); } diff --git a/sdk/storage/Azure.Storage.Queues/tests/QueueClientTests.cs b/sdk/storage/Azure.Storage.Queues/tests/QueueClientTests.cs index 2fc8e7b76a792..8bd0d97fb7491 100644 --- a/sdk/storage/Azure.Storage.Queues/tests/QueueClientTests.cs +++ b/sdk/storage/Azure.Storage.Queues/tests/QueueClientTests.cs @@ -835,11 +835,6 @@ public async Task CanHandleInvalidPeekedMessageAndReturnValid() Assert.AreEqual(nonEncodedContent, ((PeekedMessage)badMessage).Body.ToString()); } - private Task EncodingClient_InvalidQueueMessageAsync(InvalidQueueMessageEventArgs arg) - { - throw new NotImplementedException(); - } - [Test] public async Task CanSendAndReceiveNonUTFBytes() { diff --git a/sdk/storage/Azure.Storage.Queues/tests/QueueTestBase.cs b/sdk/storage/Azure.Storage.Queues/tests/QueueTestBase.cs index 258af73943d27..11c3a92fd48a5 100644 --- a/sdk/storage/Azure.Storage.Queues/tests/QueueTestBase.cs +++ b/sdk/storage/Azure.Storage.Queues/tests/QueueTestBase.cs @@ -156,13 +156,13 @@ public async Task GetTestQueueAsync( public QueueClient GetEncodingClient( string queueName, QueueMessageEncoding encoding, - Func invalidMessageHandler = default) + SyncAsyncEventHandler invalidMessageHandler = default) { var options = GetOptions(); options.MessageEncoding = encoding; + options.OnInvalidMessage += invalidMessageHandler; var service = GetServiceClient_SharedKey_UnInstrumented(options); var queueClient = service.GetQueueClient(queueName); - queueClient.InvalidQueueMessageAsync += invalidMessageHandler; return InstrumentClient(queueClient); } From 3f8aeeccbdc1181d67bc24736bcdf1fd4d7f201c Mon Sep 17 00:00:00 2001 From: Kamil Sobol Date: Tue, 26 Jan 2021 11:54:37 -0800 Subject: [PATCH 13/27] revert test change. --- sdk/core/Azure.Core.TestFramework/src/ClientTestBase.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/sdk/core/Azure.Core.TestFramework/src/ClientTestBase.cs b/sdk/core/Azure.Core.TestFramework/src/ClientTestBase.cs index eaa0aa62d0dfe..8e73d2185c4cf 100644 --- a/sdk/core/Azure.Core.TestFramework/src/ClientTestBase.cs +++ b/sdk/core/Azure.Core.TestFramework/src/ClientTestBase.cs @@ -52,8 +52,7 @@ protected internal virtual object InstrumentClient(Type clientType, object clien { foreach (MethodInfo methodInfo in clientType.GetMethods(BindingFlags.Instance | BindingFlags.Public)) { - if (!methodInfo.Name.StartsWith("add_") && !methodInfo.Name.StartsWith("remove_") // exclude events - && methodInfo.Name.EndsWith("Async") && !methodInfo.IsVirtual) + if (methodInfo.Name.EndsWith("Async") && !methodInfo.IsVirtual) { validationException = new InvalidOperationException($"Client type contains public non-virtual async method {methodInfo.Name}"); From 13cf4529e23bc12588733db5ec0c13d97a6395bf Mon Sep 17 00:00:00 2001 From: Kamil Sobol Date: Tue, 26 Jan 2021 12:05:25 -0800 Subject: [PATCH 14/27] remove direct core reference from test package. --- ...rosoft.Azure.WebJobs.Extensions.Storage.Scenario.Tests.csproj | 1 - 1 file changed, 1 deletion(-) diff --git a/sdk/storage/Microsoft.Azure.WebJobs.Extensions.Storage.Scenario.Tests/tests/Microsoft.Azure.WebJobs.Extensions.Storage.Scenario.Tests.csproj b/sdk/storage/Microsoft.Azure.WebJobs.Extensions.Storage.Scenario.Tests/tests/Microsoft.Azure.WebJobs.Extensions.Storage.Scenario.Tests.csproj index 4c66a2815acd3..ddff00e6ca1eb 100644 --- a/sdk/storage/Microsoft.Azure.WebJobs.Extensions.Storage.Scenario.Tests/tests/Microsoft.Azure.WebJobs.Extensions.Storage.Scenario.Tests.csproj +++ b/sdk/storage/Microsoft.Azure.WebJobs.Extensions.Storage.Scenario.Tests/tests/Microsoft.Azure.WebJobs.Extensions.Storage.Scenario.Tests.csproj @@ -13,7 +13,6 @@ - From af47e2cf5aae5841b31e6d7616304f54086137b8 Mon Sep 17 00:00:00 2001 From: Kamil Sobol Date: Tue, 26 Jan 2021 13:20:29 -0800 Subject: [PATCH 15/27] that won't be necessary. --- .../tests/Shared/StorageTestBase.cs | 22 ------------------- .../tests/QueueClientTests.cs | 4 ++-- 2 files changed, 2 insertions(+), 24 deletions(-) diff --git a/sdk/storage/Azure.Storage.Common/tests/Shared/StorageTestBase.cs b/sdk/storage/Azure.Storage.Common/tests/Shared/StorageTestBase.cs index 72f2447326cee..b6477abf00935 100644 --- a/sdk/storage/Azure.Storage.Common/tests/Shared/StorageTestBase.cs +++ b/sdk/storage/Azure.Storage.Common/tests/Shared/StorageTestBase.cs @@ -362,28 +362,6 @@ protected async Task WaitForProgressAsync(System.Collections.Concurrent.Concurre Assert.Warn("Progress notifications never completed!"); } - protected async Task WaitForCondition(Func predicate, int tries = 5, TimeSpan delay = default) - { - if (delay == default) - { - delay = TimeSpan.FromSeconds(2); - } - - for (int i = 0; i < tries; i++) - { - if (predicate()) - { - return; - } - else - { - await Task.Delay(delay); - } - } - - throw new Exception("Condition not reached"); - } - protected void AssertSecondaryStorageFirstRetrySuccessful(string primaryHost, string secondaryHost, TestExceptionPolicy testExceptionPolicy) { Assert.AreEqual(primaryHost, testExceptionPolicy.HostsSetInRequests[0]); diff --git a/sdk/storage/Azure.Storage.Queues/tests/QueueClientTests.cs b/sdk/storage/Azure.Storage.Queues/tests/QueueClientTests.cs index 8bd0d97fb7491..3a53d86910d81 100644 --- a/sdk/storage/Azure.Storage.Queues/tests/QueueClientTests.cs +++ b/sdk/storage/Azure.Storage.Queues/tests/QueueClientTests.cs @@ -831,7 +831,7 @@ public async Task CanHandleInvalidPeekedMessageAndReturnValid() // Assert Assert.AreEqual(1, peekedMessages.Count()); - await WaitForCondition(() => badMessage != null); + Assert.NotNull(badMessage); Assert.AreEqual(nonEncodedContent, ((PeekedMessage)badMessage).Body.ToString()); } @@ -899,7 +899,7 @@ public async Task CanHandleInvalidMessageAndReturnValid() // Assert Assert.AreEqual(1, queueMessages.Count()); - await WaitForCondition(() => badMessage != null); + Assert.NotNull(badMessage); Assert.AreEqual(nonEncodedContent, ((QueueMessage)badMessage).Body.ToString()); } From 7cad45d05410b510672d5dbce54d5530ea2edcc1 Mon Sep 17 00:00:00 2001 From: Kamil Sobol Date: Tue, 26 Jan 2021 13:29:22 -0800 Subject: [PATCH 16/27] more tests. --- .../tests/QueueClientTests.cs | 80 +++++++++ .../tests/QueueTestBase.cs | 7 +- ...fInvalidPeekedMessageAndHandlerThrows.json | 167 ++++++++++++++++++ ...lidPeekedMessageAndHandlerThrowsAsync.json | 167 ++++++++++++++++++ ...IfInvalidQueueMessageAndHandlerThrows.json | 167 ++++++++++++++++++ ...alidQueueMessageAndHandlerThrowsAsync.json | 167 ++++++++++++++++++ 6 files changed, 753 insertions(+), 2 deletions(-) create mode 100644 sdk/storage/Azure.Storage.Queues/tests/SessionRecords/QueueClientTests/PropagatesExceptionIfInvalidPeekedMessageAndHandlerThrows.json create mode 100644 sdk/storage/Azure.Storage.Queues/tests/SessionRecords/QueueClientTests/PropagatesExceptionIfInvalidPeekedMessageAndHandlerThrowsAsync.json create mode 100644 sdk/storage/Azure.Storage.Queues/tests/SessionRecords/QueueClientTests/PropagatesExceptionIfInvalidQueueMessageAndHandlerThrows.json create mode 100644 sdk/storage/Azure.Storage.Queues/tests/SessionRecords/QueueClientTests/PropagatesExceptionIfInvalidQueueMessageAndHandlerThrowsAsync.json diff --git a/sdk/storage/Azure.Storage.Queues/tests/QueueClientTests.cs b/sdk/storage/Azure.Storage.Queues/tests/QueueClientTests.cs index 3a53d86910d81..54ba300170b67 100644 --- a/sdk/storage/Azure.Storage.Queues/tests/QueueClientTests.cs +++ b/sdk/storage/Azure.Storage.Queues/tests/QueueClientTests.cs @@ -813,6 +813,7 @@ public async Task CanHandleInvalidPeekedMessageAndReturnValid() // Arrange await using DisposingQueue test = await GetTestQueueAsync(); object badMessage = null; + object badMessage2 = null; var encodingClient = GetEncodingClient( test.Queue.Name, QueueMessageEncoding.Base64, @@ -820,6 +821,11 @@ public async Task CanHandleInvalidPeekedMessageAndReturnValid() { badMessage = arg.Message; return Task.CompletedTask; + }, + arg => + { + badMessage2 = arg.Message; + return Task.CompletedTask; }); var nonEncodedContent = "test_content"; @@ -833,6 +839,40 @@ public async Task CanHandleInvalidPeekedMessageAndReturnValid() Assert.AreEqual(1, peekedMessages.Count()); Assert.NotNull(badMessage); Assert.AreEqual(nonEncodedContent, ((PeekedMessage)badMessage).Body.ToString()); + Assert.NotNull(badMessage2); + Assert.AreEqual(nonEncodedContent, ((PeekedMessage)badMessage2).Body.ToString()); + } + + [Test] + public async Task PropagatesExceptionIfInvalidPeekedMessageAndHandlerThrows() + { + // Arrange + await using DisposingQueue test = await GetTestQueueAsync(); + var encodingClient = GetEncodingClient( + test.Queue.Name, + QueueMessageEncoding.Base64, + arg => + { + throw new ArgumentException("KABOOM1"); + }, + arg => + { + throw new ArgumentException("KABOOM2"); + }); + var nonEncodedContent = "test_content"; + + await test.Queue.SendMessageAsync(nonEncodedContent); + await encodingClient.SendMessageAsync(nonEncodedContent); + + // Act + await TestHelper.AssertExpectedExceptionAsync( + encodingClient.PeekMessagesAsync(10), + e => + { + Assert.AreEqual(2, e.InnerExceptions.Count); + Assert.AreEqual("KABOOM1", e.InnerExceptions[0].Message); + Assert.AreEqual("KABOOM2", e.InnerExceptions[1].Message); + }); } [Test] @@ -881,6 +921,7 @@ public async Task CanHandleInvalidMessageAndReturnValid() // Arrange await using DisposingQueue test = await GetTestQueueAsync(); object badMessage = null; + object badMessage2 = null; var encodingClient = GetEncodingClient( test.Queue.Name, QueueMessageEncoding.Base64, @@ -888,6 +929,11 @@ public async Task CanHandleInvalidMessageAndReturnValid() { badMessage = arg.Message; return Task.CompletedTask; + }, + arg => + { + badMessage2 = arg.Message; + return Task.CompletedTask; }); var nonEncodedContent = "test_content"; @@ -901,6 +947,40 @@ public async Task CanHandleInvalidMessageAndReturnValid() Assert.AreEqual(1, queueMessages.Count()); Assert.NotNull(badMessage); Assert.AreEqual(nonEncodedContent, ((QueueMessage)badMessage).Body.ToString()); + Assert.NotNull(badMessage2); + Assert.AreEqual(nonEncodedContent, ((QueueMessage)badMessage2).Body.ToString()); + } + + [Test] + public async Task PropagatesExceptionIfInvalidQueueMessageAndHandlerThrows() + { + // Arrange + await using DisposingQueue test = await GetTestQueueAsync(); + var encodingClient = GetEncodingClient( + test.Queue.Name, + QueueMessageEncoding.Base64, + arg => + { + throw new ArgumentException("KABOOM1"); + }, + arg => + { + throw new ArgumentException("KABOOM2"); + }); + var nonEncodedContent = "test_content"; + + await test.Queue.SendMessageAsync(nonEncodedContent); + await encodingClient.SendMessageAsync(nonEncodedContent); + + // Act + await TestHelper.AssertExpectedExceptionAsync( + encodingClient.ReceiveMessagesAsync(10), + e => + { + Assert.AreEqual(2, e.InnerExceptions.Count); + Assert.AreEqual("KABOOM1", e.InnerExceptions[0].Message); + Assert.AreEqual("KABOOM2", e.InnerExceptions[1].Message); + }); } [Test] diff --git a/sdk/storage/Azure.Storage.Queues/tests/QueueTestBase.cs b/sdk/storage/Azure.Storage.Queues/tests/QueueTestBase.cs index 11c3a92fd48a5..aad35bee0baf7 100644 --- a/sdk/storage/Azure.Storage.Queues/tests/QueueTestBase.cs +++ b/sdk/storage/Azure.Storage.Queues/tests/QueueTestBase.cs @@ -156,11 +156,14 @@ public async Task GetTestQueueAsync( public QueueClient GetEncodingClient( string queueName, QueueMessageEncoding encoding, - SyncAsyncEventHandler invalidMessageHandler = default) + params SyncAsyncEventHandler[] invalidMessageHandlers) { var options = GetOptions(); options.MessageEncoding = encoding; - options.OnInvalidMessage += invalidMessageHandler; + foreach (var invalidMessageHandler in invalidMessageHandlers) + { + options.OnInvalidMessage += invalidMessageHandler; + } var service = GetServiceClient_SharedKey_UnInstrumented(options); var queueClient = service.GetQueueClient(queueName); return InstrumentClient(queueClient); diff --git a/sdk/storage/Azure.Storage.Queues/tests/SessionRecords/QueueClientTests/PropagatesExceptionIfInvalidPeekedMessageAndHandlerThrows.json b/sdk/storage/Azure.Storage.Queues/tests/SessionRecords/QueueClientTests/PropagatesExceptionIfInvalidPeekedMessageAndHandlerThrows.json new file mode 100644 index 0000000000000..f6cb487364409 --- /dev/null +++ b/sdk/storage/Azure.Storage.Queues/tests/SessionRecords/QueueClientTests/PropagatesExceptionIfInvalidPeekedMessageAndHandlerThrows.json @@ -0,0 +1,167 @@ +{ + "Entries": [ + { + "RequestUri": "https://kasoboltest.queue.core.windows.net/test-queue-31d00514-00c0-1d48-9da1-bdf952ba3398", + "RequestMethod": "PUT", + "RequestHeaders": { + "Accept": "application/xml", + "Authorization": "Sanitized", + "traceparent": "00-d678313a2e01d549ad092f5b9461e801-62a355d08b75864c-00", + "User-Agent": [ + "azsdk-net-Storage.Queues/12.7.0-alpha.20210126.1", + "(.NET Framework 4.8.4250.0; Microsoft Windows 10.0.19042 )" + ], + "x-ms-client-request-id": "01ea357b-7563-e55a-02ac-a6777b209cb4", + "x-ms-date": "Tue, 26 Jan 2021 21:28:03 GMT", + "x-ms-return-client-request-id": "true", + "x-ms-version": "2018-11-09" + }, + "RequestBody": null, + "StatusCode": 201, + "ResponseHeaders": { + "Content-Length": "0", + "Date": "Tue, 26 Jan 2021 21:28:02 GMT", + "Server": [ + "Windows-Azure-Queue/1.0", + "Microsoft-HTTPAPI/2.0" + ], + "x-ms-request-id": "c8c7ead8-8003-0012-0e2a-f460ef000000", + "x-ms-version": "2018-11-09" + }, + "ResponseBody": [] + }, + { + "RequestUri": "https://kasoboltest.queue.core.windows.net/test-queue-31d00514-00c0-1d48-9da1-bdf952ba3398/messages", + "RequestMethod": "POST", + "RequestHeaders": { + "Accept": "application/xml", + "Authorization": "Sanitized", + "Content-Length": "71", + "Content-Type": "application/xml", + "traceparent": "00-62b898586107cc42acb1410bae285418-3396eb7dd56bea42-00", + "User-Agent": [ + "azsdk-net-Storage.Queues/12.7.0-alpha.20210126.1", + "(.NET Framework 4.8.4250.0; Microsoft Windows 10.0.19042 )" + ], + "x-ms-client-request-id": "1c7dad3e-31cf-cf35-b666-9f8324fab1d4", + "x-ms-date": "Tue, 26 Jan 2021 21:28:03 GMT", + "x-ms-return-client-request-id": "true", + "x-ms-version": "2018-11-09" + }, + "RequestBody": "\uFEFF\u003CQueueMessage\u003E\u003CMessageText\u003Etest_content\u003C/MessageText\u003E\u003C/QueueMessage\u003E", + "StatusCode": 201, + "ResponseHeaders": { + "Content-Type": "application/xml", + "Date": "Tue, 26 Jan 2021 21:28:02 GMT", + "Server": [ + "Windows-Azure-Queue/1.0", + "Microsoft-HTTPAPI/2.0" + ], + "Transfer-Encoding": "chunked", + "x-ms-request-id": "c8c7eaee-8003-0012-222a-f460ef000000", + "x-ms-version": "2018-11-09" + }, + "ResponseBody": "\uFEFF\u003C?xml version=\u00221.0\u0022 encoding=\u0022utf-8\u0022?\u003E\u003CQueueMessagesList\u003E\u003CQueueMessage\u003E\u003CMessageId\u003Eae03f2a9-e69c-4b64-b105-493b860ab756\u003C/MessageId\u003E\u003CInsertionTime\u003ETue, 26 Jan 2021 21:28:03 GMT\u003C/InsertionTime\u003E\u003CExpirationTime\u003ETue, 02 Feb 2021 21:28:03 GMT\u003C/ExpirationTime\u003E\u003CPopReceipt\u003EAgAAAAMAAAAAAAAAjedBISr01gE=\u003C/PopReceipt\u003E\u003CTimeNextVisible\u003ETue, 26 Jan 2021 21:28:03 GMT\u003C/TimeNextVisible\u003E\u003C/QueueMessage\u003E\u003C/QueueMessagesList\u003E" + }, + { + "RequestUri": "https://kasoboltest.queue.core.windows.net/test-queue-31d00514-00c0-1d48-9da1-bdf952ba3398/messages", + "RequestMethod": "POST", + "RequestHeaders": { + "Accept": "application/xml", + "Authorization": "Sanitized", + "Content-Length": "75", + "Content-Type": "application/xml", + "traceparent": "00-8554e7517af20241a6bc4b3df97a8748-78bccf37fa52844d-00", + "User-Agent": [ + "azsdk-net-Storage.Queues/12.7.0-alpha.20210126.1", + "(.NET Framework 4.8.4250.0; Microsoft Windows 10.0.19042 )" + ], + "x-ms-client-request-id": "ce381fde-80a3-7ee4-e13a-43905c1d2599", + "x-ms-date": "Tue, 26 Jan 2021 21:28:03 GMT", + "x-ms-return-client-request-id": "true", + "x-ms-version": "2018-11-09" + }, + "RequestBody": "\uFEFF\u003CQueueMessage\u003E\u003CMessageText\u003EdGVzdF9jb250ZW50\u003C/MessageText\u003E\u003C/QueueMessage\u003E", + "StatusCode": 201, + "ResponseHeaders": { + "Content-Type": "application/xml", + "Date": "Tue, 26 Jan 2021 21:28:03 GMT", + "Server": [ + "Windows-Azure-Queue/1.0", + "Microsoft-HTTPAPI/2.0" + ], + "Transfer-Encoding": "chunked", + "x-ms-request-id": "5981583d-2003-0036-4c2a-f4f9a1000000", + "x-ms-version": "2018-11-09" + }, + "ResponseBody": "\uFEFF\u003C?xml version=\u00221.0\u0022 encoding=\u0022utf-8\u0022?\u003E\u003CQueueMessagesList\u003E\u003CQueueMessage\u003E\u003CMessageId\u003E37ca380a-dfed-4169-b920-f18b9f33ded2\u003C/MessageId\u003E\u003CInsertionTime\u003ETue, 26 Jan 2021 21:28:03 GMT\u003C/InsertionTime\u003E\u003CExpirationTime\u003ETue, 02 Feb 2021 21:28:03 GMT\u003C/ExpirationTime\u003E\u003CPopReceipt\u003EAgAAAAMAAAAAAAAAQm9XISr01gE=\u003C/PopReceipt\u003E\u003CTimeNextVisible\u003ETue, 26 Jan 2021 21:28:03 GMT\u003C/TimeNextVisible\u003E\u003C/QueueMessage\u003E\u003C/QueueMessagesList\u003E" + }, + { + "RequestUri": "https://kasoboltest.queue.core.windows.net/test-queue-31d00514-00c0-1d48-9da1-bdf952ba3398/messages?peekonly=true\u0026numofmessages=10", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "application/xml", + "Authorization": "Sanitized", + "traceparent": "00-6287b50cec6d824081e8c8ad8b386415-365050e69995d04f-00", + "User-Agent": [ + "azsdk-net-Storage.Queues/12.7.0-alpha.20210126.1", + "(.NET Framework 4.8.4250.0; Microsoft Windows 10.0.19042 )" + ], + "x-ms-client-request-id": "05a47cf6-e3c1-8731-f23a-56d224892376", + "x-ms-date": "Tue, 26 Jan 2021 21:28:04 GMT", + "x-ms-return-client-request-id": "true", + "x-ms-version": "2018-11-09" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "Cache-Control": "no-cache", + "Content-Type": "application/xml", + "Date": "Tue, 26 Jan 2021 21:28:03 GMT", + "Server": [ + "Windows-Azure-Queue/1.0", + "Microsoft-HTTPAPI/2.0" + ], + "Transfer-Encoding": "chunked", + "Vary": "Origin", + "x-ms-request-id": "5981586a-2003-0036-752a-f4f9a1000000", + "x-ms-version": "2018-11-09" + }, + "ResponseBody": "\uFEFF\u003C?xml version=\u00221.0\u0022 encoding=\u0022utf-8\u0022?\u003E\u003CQueueMessagesList\u003E\u003CQueueMessage\u003E\u003CMessageId\u003Eae03f2a9-e69c-4b64-b105-493b860ab756\u003C/MessageId\u003E\u003CInsertionTime\u003ETue, 26 Jan 2021 21:28:03 GMT\u003C/InsertionTime\u003E\u003CExpirationTime\u003ETue, 02 Feb 2021 21:28:03 GMT\u003C/ExpirationTime\u003E\u003CDequeueCount\u003E0\u003C/DequeueCount\u003E\u003CMessageText\u003Etest_content\u003C/MessageText\u003E\u003C/QueueMessage\u003E\u003CQueueMessage\u003E\u003CMessageId\u003E37ca380a-dfed-4169-b920-f18b9f33ded2\u003C/MessageId\u003E\u003CInsertionTime\u003ETue, 26 Jan 2021 21:28:03 GMT\u003C/InsertionTime\u003E\u003CExpirationTime\u003ETue, 02 Feb 2021 21:28:03 GMT\u003C/ExpirationTime\u003E\u003CDequeueCount\u003E0\u003C/DequeueCount\u003E\u003CMessageText\u003EdGVzdF9jb250ZW50\u003C/MessageText\u003E\u003C/QueueMessage\u003E\u003C/QueueMessagesList\u003E" + }, + { + "RequestUri": "https://kasoboltest.queue.core.windows.net/test-queue-31d00514-00c0-1d48-9da1-bdf952ba3398", + "RequestMethod": "DELETE", + "RequestHeaders": { + "Accept": "application/xml", + "Authorization": "Sanitized", + "traceparent": "00-c8a0288263dcab41a85e12af30b59eb4-bfcc641e1c3c3c4a-00", + "User-Agent": [ + "azsdk-net-Storage.Queues/12.7.0-alpha.20210126.1", + "(.NET Framework 4.8.4250.0; Microsoft Windows 10.0.19042 )" + ], + "x-ms-client-request-id": "e09acca4-2079-0ed7-368b-aaeb40a6b109", + "x-ms-date": "Tue, 26 Jan 2021 21:28:04 GMT", + "x-ms-return-client-request-id": "true", + "x-ms-version": "2018-11-09" + }, + "RequestBody": null, + "StatusCode": 204, + "ResponseHeaders": { + "Content-Length": "0", + "Date": "Tue, 26 Jan 2021 21:28:03 GMT", + "Server": [ + "Windows-Azure-Queue/1.0", + "Microsoft-HTTPAPI/2.0" + ], + "x-ms-request-id": "c8c7eb17-8003-0012-4a2a-f460ef000000", + "x-ms-version": "2018-11-09" + }, + "ResponseBody": [] + } + ], + "Variables": { + "RandomSeed": "1137513990", + "Storage_TestConfigDefault": "ProductionTenant\nkasoboltest\nU2FuaXRpemVk\nhttps://kasoboltest.blob.core.windows.net\nhttps://kasoboltest.file.core.windows.net\nhttps://kasoboltest.queue.core.windows.net\nhttps://kasoboltest.table.core.windows.net\n\n\n\n\nhttps://kasoboltest-secondary.blob.core.windows.net\nhttps://kasoboltest-secondary.file.core.windows.net\nhttps://kasoboltest-secondary.queue.core.windows.net\nhttps://kasoboltest-secondary.table.core.windows.net\n\nSanitized\n\n\nCloud\nBlobEndpoint=https://kasoboltest.blob.core.windows.net/;QueueEndpoint=https://kasoboltest.queue.core.windows.net/;FileEndpoint=https://kasoboltest.file.core.windows.net/;BlobSecondaryEndpoint=https://kasoboltest-secondary.blob.core.windows.net/;QueueSecondaryEndpoint=https://kasoboltest-secondary.queue.core.windows.net/;FileSecondaryEndpoint=https://kasoboltest-secondary.file.core.windows.net/;AccountName=kasoboltest;AccountKey=Kg==;\nencryptionScope" + } +} \ No newline at end of file diff --git a/sdk/storage/Azure.Storage.Queues/tests/SessionRecords/QueueClientTests/PropagatesExceptionIfInvalidPeekedMessageAndHandlerThrowsAsync.json b/sdk/storage/Azure.Storage.Queues/tests/SessionRecords/QueueClientTests/PropagatesExceptionIfInvalidPeekedMessageAndHandlerThrowsAsync.json new file mode 100644 index 0000000000000..dee3251ee4512 --- /dev/null +++ b/sdk/storage/Azure.Storage.Queues/tests/SessionRecords/QueueClientTests/PropagatesExceptionIfInvalidPeekedMessageAndHandlerThrowsAsync.json @@ -0,0 +1,167 @@ +{ + "Entries": [ + { + "RequestUri": "https://kasoboltest.queue.core.windows.net/test-queue-f21ec946-2a81-7e98-5f46-176a6998a7d1", + "RequestMethod": "PUT", + "RequestHeaders": { + "Accept": "application/xml", + "Authorization": "Sanitized", + "traceparent": "00-05a7071699a6a74db622ce2dafebc275-abcd78e8de225340-00", + "User-Agent": [ + "azsdk-net-Storage.Queues/12.7.0-alpha.20210126.1", + "(.NET Framework 4.8.4250.0; Microsoft Windows 10.0.19042 )" + ], + "x-ms-client-request-id": "b9ab3075-5d04-4f67-4cda-652ab1ff8f08", + "x-ms-date": "Tue, 26 Jan 2021 21:28:04 GMT", + "x-ms-return-client-request-id": "true", + "x-ms-version": "2018-11-09" + }, + "RequestBody": null, + "StatusCode": 201, + "ResponseHeaders": { + "Content-Length": "0", + "Date": "Tue, 26 Jan 2021 21:28:03 GMT", + "Server": [ + "Windows-Azure-Queue/1.0", + "Microsoft-HTTPAPI/2.0" + ], + "x-ms-request-id": "34729942-6003-0057-042a-f4bd7e000000", + "x-ms-version": "2018-11-09" + }, + "ResponseBody": [] + }, + { + "RequestUri": "https://kasoboltest.queue.core.windows.net/test-queue-f21ec946-2a81-7e98-5f46-176a6998a7d1/messages", + "RequestMethod": "POST", + "RequestHeaders": { + "Accept": "application/xml", + "Authorization": "Sanitized", + "Content-Length": "71", + "Content-Type": "application/xml", + "traceparent": "00-ac895c1f43693c4885b4541e73009333-c2076c1975838247-00", + "User-Agent": [ + "azsdk-net-Storage.Queues/12.7.0-alpha.20210126.1", + "(.NET Framework 4.8.4250.0; Microsoft Windows 10.0.19042 )" + ], + "x-ms-client-request-id": "38f42d2a-eeed-f3cd-eb7c-30809ee9ac96", + "x-ms-date": "Tue, 26 Jan 2021 21:28:04 GMT", + "x-ms-return-client-request-id": "true", + "x-ms-version": "2018-11-09" + }, + "RequestBody": "\uFEFF\u003CQueueMessage\u003E\u003CMessageText\u003Etest_content\u003C/MessageText\u003E\u003C/QueueMessage\u003E", + "StatusCode": 201, + "ResponseHeaders": { + "Content-Type": "application/xml", + "Date": "Tue, 26 Jan 2021 21:28:03 GMT", + "Server": [ + "Windows-Azure-Queue/1.0", + "Microsoft-HTTPAPI/2.0" + ], + "Transfer-Encoding": "chunked", + "x-ms-request-id": "34729990-6003-0057-4d2a-f4bd7e000000", + "x-ms-version": "2018-11-09" + }, + "ResponseBody": "\uFEFF\u003C?xml version=\u00221.0\u0022 encoding=\u0022utf-8\u0022?\u003E\u003CQueueMessagesList\u003E\u003CQueueMessage\u003E\u003CMessageId\u003Eba88b4e4-7887-4e08-847c-d5ce88294dbf\u003C/MessageId\u003E\u003CInsertionTime\u003ETue, 26 Jan 2021 21:28:04 GMT\u003C/InsertionTime\u003E\u003CExpirationTime\u003ETue, 02 Feb 2021 21:28:04 GMT\u003C/ExpirationTime\u003E\u003CPopReceipt\u003EAgAAAAMAAAAAAAAAQiG9ISr01gE=\u003C/PopReceipt\u003E\u003CTimeNextVisible\u003ETue, 26 Jan 2021 21:28:04 GMT\u003C/TimeNextVisible\u003E\u003C/QueueMessage\u003E\u003C/QueueMessagesList\u003E" + }, + { + "RequestUri": "https://kasoboltest.queue.core.windows.net/test-queue-f21ec946-2a81-7e98-5f46-176a6998a7d1/messages", + "RequestMethod": "POST", + "RequestHeaders": { + "Accept": "application/xml", + "Authorization": "Sanitized", + "Content-Length": "75", + "Content-Type": "application/xml", + "traceparent": "00-81c9c3380a333142948ccca1b0ea3a9b-01b6462d88576e4d-00", + "User-Agent": [ + "azsdk-net-Storage.Queues/12.7.0-alpha.20210126.1", + "(.NET Framework 4.8.4250.0; Microsoft Windows 10.0.19042 )" + ], + "x-ms-client-request-id": "8300b04c-560b-c61b-1148-098d11a5a4cc", + "x-ms-date": "Tue, 26 Jan 2021 21:28:04 GMT", + "x-ms-return-client-request-id": "true", + "x-ms-version": "2018-11-09" + }, + "RequestBody": "\uFEFF\u003CQueueMessage\u003E\u003CMessageText\u003EdGVzdF9jb250ZW50\u003C/MessageText\u003E\u003C/QueueMessage\u003E", + "StatusCode": 201, + "ResponseHeaders": { + "Content-Type": "application/xml", + "Date": "Tue, 26 Jan 2021 21:28:04 GMT", + "Server": [ + "Windows-Azure-Queue/1.0", + "Microsoft-HTTPAPI/2.0" + ], + "Transfer-Encoding": "chunked", + "x-ms-request-id": "978d4c2f-3003-0000-462a-f454f3000000", + "x-ms-version": "2018-11-09" + }, + "ResponseBody": "\uFEFF\u003C?xml version=\u00221.0\u0022 encoding=\u0022utf-8\u0022?\u003E\u003CQueueMessagesList\u003E\u003CQueueMessage\u003E\u003CMessageId\u003E0dd9a7dc-5abe-40a3-a670-6aeeb6d59610\u003C/MessageId\u003E\u003CInsertionTime\u003ETue, 26 Jan 2021 21:28:04 GMT\u003C/InsertionTime\u003E\u003CExpirationTime\u003ETue, 02 Feb 2021 21:28:04 GMT\u003C/ExpirationTime\u003E\u003CPopReceipt\u003EAgAAAAMAAAAAAAAAn17QISr01gE=\u003C/PopReceipt\u003E\u003CTimeNextVisible\u003ETue, 26 Jan 2021 21:28:04 GMT\u003C/TimeNextVisible\u003E\u003C/QueueMessage\u003E\u003C/QueueMessagesList\u003E" + }, + { + "RequestUri": "https://kasoboltest.queue.core.windows.net/test-queue-f21ec946-2a81-7e98-5f46-176a6998a7d1/messages?peekonly=true\u0026numofmessages=10", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "application/xml", + "Authorization": "Sanitized", + "traceparent": "00-1378e4b8c6d58843b9a249a406ad73d5-d0cc40dac53eb64b-00", + "User-Agent": [ + "azsdk-net-Storage.Queues/12.7.0-alpha.20210126.1", + "(.NET Framework 4.8.4250.0; Microsoft Windows 10.0.19042 )" + ], + "x-ms-client-request-id": "ee34eb35-28e8-328b-fc15-ff251c532265", + "x-ms-date": "Tue, 26 Jan 2021 21:28:04 GMT", + "x-ms-return-client-request-id": "true", + "x-ms-version": "2018-11-09" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "Cache-Control": "no-cache", + "Content-Type": "application/xml", + "Date": "Tue, 26 Jan 2021 21:28:04 GMT", + "Server": [ + "Windows-Azure-Queue/1.0", + "Microsoft-HTTPAPI/2.0" + ], + "Transfer-Encoding": "chunked", + "Vary": "Origin", + "x-ms-request-id": "978d4c48-3003-0000-5c2a-f454f3000000", + "x-ms-version": "2018-11-09" + }, + "ResponseBody": "\uFEFF\u003C?xml version=\u00221.0\u0022 encoding=\u0022utf-8\u0022?\u003E\u003CQueueMessagesList\u003E\u003CQueueMessage\u003E\u003CMessageId\u003Eba88b4e4-7887-4e08-847c-d5ce88294dbf\u003C/MessageId\u003E\u003CInsertionTime\u003ETue, 26 Jan 2021 21:28:04 GMT\u003C/InsertionTime\u003E\u003CExpirationTime\u003ETue, 02 Feb 2021 21:28:04 GMT\u003C/ExpirationTime\u003E\u003CDequeueCount\u003E0\u003C/DequeueCount\u003E\u003CMessageText\u003Etest_content\u003C/MessageText\u003E\u003C/QueueMessage\u003E\u003CQueueMessage\u003E\u003CMessageId\u003E0dd9a7dc-5abe-40a3-a670-6aeeb6d59610\u003C/MessageId\u003E\u003CInsertionTime\u003ETue, 26 Jan 2021 21:28:04 GMT\u003C/InsertionTime\u003E\u003CExpirationTime\u003ETue, 02 Feb 2021 21:28:04 GMT\u003C/ExpirationTime\u003E\u003CDequeueCount\u003E0\u003C/DequeueCount\u003E\u003CMessageText\u003EdGVzdF9jb250ZW50\u003C/MessageText\u003E\u003C/QueueMessage\u003E\u003C/QueueMessagesList\u003E" + }, + { + "RequestUri": "https://kasoboltest.queue.core.windows.net/test-queue-f21ec946-2a81-7e98-5f46-176a6998a7d1", + "RequestMethod": "DELETE", + "RequestHeaders": { + "Accept": "application/xml", + "Authorization": "Sanitized", + "traceparent": "00-1af8468c9acdb0489132d0d1c3259281-747920d2cad9e847-00", + "User-Agent": [ + "azsdk-net-Storage.Queues/12.7.0-alpha.20210126.1", + "(.NET Framework 4.8.4250.0; Microsoft Windows 10.0.19042 )" + ], + "x-ms-client-request-id": "26571c56-b571-ece4-39ae-f4177d22e7f9", + "x-ms-date": "Tue, 26 Jan 2021 21:28:04 GMT", + "x-ms-return-client-request-id": "true", + "x-ms-version": "2018-11-09" + }, + "RequestBody": null, + "StatusCode": 204, + "ResponseHeaders": { + "Content-Length": "0", + "Date": "Tue, 26 Jan 2021 21:28:04 GMT", + "Server": [ + "Windows-Azure-Queue/1.0", + "Microsoft-HTTPAPI/2.0" + ], + "x-ms-request-id": "34729a1f-6003-0057-5c2a-f4bd7e000000", + "x-ms-version": "2018-11-09" + }, + "ResponseBody": [] + } + ], + "Variables": { + "RandomSeed": "203054038", + "Storage_TestConfigDefault": "ProductionTenant\nkasoboltest\nU2FuaXRpemVk\nhttps://kasoboltest.blob.core.windows.net\nhttps://kasoboltest.file.core.windows.net\nhttps://kasoboltest.queue.core.windows.net\nhttps://kasoboltest.table.core.windows.net\n\n\n\n\nhttps://kasoboltest-secondary.blob.core.windows.net\nhttps://kasoboltest-secondary.file.core.windows.net\nhttps://kasoboltest-secondary.queue.core.windows.net\nhttps://kasoboltest-secondary.table.core.windows.net\n\nSanitized\n\n\nCloud\nBlobEndpoint=https://kasoboltest.blob.core.windows.net/;QueueEndpoint=https://kasoboltest.queue.core.windows.net/;FileEndpoint=https://kasoboltest.file.core.windows.net/;BlobSecondaryEndpoint=https://kasoboltest-secondary.blob.core.windows.net/;QueueSecondaryEndpoint=https://kasoboltest-secondary.queue.core.windows.net/;FileSecondaryEndpoint=https://kasoboltest-secondary.file.core.windows.net/;AccountName=kasoboltest;AccountKey=Kg==;\nencryptionScope" + } +} \ No newline at end of file diff --git a/sdk/storage/Azure.Storage.Queues/tests/SessionRecords/QueueClientTests/PropagatesExceptionIfInvalidQueueMessageAndHandlerThrows.json b/sdk/storage/Azure.Storage.Queues/tests/SessionRecords/QueueClientTests/PropagatesExceptionIfInvalidQueueMessageAndHandlerThrows.json new file mode 100644 index 0000000000000..21822d1f9f723 --- /dev/null +++ b/sdk/storage/Azure.Storage.Queues/tests/SessionRecords/QueueClientTests/PropagatesExceptionIfInvalidQueueMessageAndHandlerThrows.json @@ -0,0 +1,167 @@ +{ + "Entries": [ + { + "RequestUri": "https://kasoboltest.queue.core.windows.net/test-queue-1b097e93-0e7d-d7d2-f594-fa98802a79aa", + "RequestMethod": "PUT", + "RequestHeaders": { + "Accept": "application/xml", + "Authorization": "Sanitized", + "traceparent": "00-3d2dd5d5a82efd48b850a741704077f7-e4be991149b58f49-00", + "User-Agent": [ + "azsdk-net-Storage.Queues/12.7.0-alpha.20210126.1", + "(.NET Framework 4.8.4250.0; Microsoft Windows 10.0.19042 )" + ], + "x-ms-client-request-id": "4a656755-982b-519e-75a5-dd9967a1f9dd", + "x-ms-date": "Tue, 26 Jan 2021 21:29:09 GMT", + "x-ms-return-client-request-id": "true", + "x-ms-version": "2018-11-09" + }, + "RequestBody": null, + "StatusCode": 201, + "ResponseHeaders": { + "Content-Length": "0", + "Date": "Tue, 26 Jan 2021 21:29:09 GMT", + "Server": [ + "Windows-Azure-Queue/1.0", + "Microsoft-HTTPAPI/2.0" + ], + "x-ms-request-id": "78b7a107-b003-0011-162a-f463e8000000", + "x-ms-version": "2018-11-09" + }, + "ResponseBody": [] + }, + { + "RequestUri": "https://kasoboltest.queue.core.windows.net/test-queue-1b097e93-0e7d-d7d2-f594-fa98802a79aa/messages", + "RequestMethod": "POST", + "RequestHeaders": { + "Accept": "application/xml", + "Authorization": "Sanitized", + "Content-Length": "71", + "Content-Type": "application/xml", + "traceparent": "00-ac8d405d6282f44eb9930357e86300da-e7cc111f516f1d42-00", + "User-Agent": [ + "azsdk-net-Storage.Queues/12.7.0-alpha.20210126.1", + "(.NET Framework 4.8.4250.0; Microsoft Windows 10.0.19042 )" + ], + "x-ms-client-request-id": "19436cb0-2ec5-987e-2a56-f9f39c4d9332", + "x-ms-date": "Tue, 26 Jan 2021 21:29:10 GMT", + "x-ms-return-client-request-id": "true", + "x-ms-version": "2018-11-09" + }, + "RequestBody": "\uFEFF\u003CQueueMessage\u003E\u003CMessageText\u003Etest_content\u003C/MessageText\u003E\u003C/QueueMessage\u003E", + "StatusCode": 201, + "ResponseHeaders": { + "Content-Type": "application/xml", + "Date": "Tue, 26 Jan 2021 21:29:09 GMT", + "Server": [ + "Windows-Azure-Queue/1.0", + "Microsoft-HTTPAPI/2.0" + ], + "Transfer-Encoding": "chunked", + "x-ms-request-id": "78b7a122-b003-0011-2f2a-f463e8000000", + "x-ms-version": "2018-11-09" + }, + "ResponseBody": "\uFEFF\u003C?xml version=\u00221.0\u0022 encoding=\u0022utf-8\u0022?\u003E\u003CQueueMessagesList\u003E\u003CQueueMessage\u003E\u003CMessageId\u003Eeafadc16-f4ca-4fc5-a43d-db377cee337f\u003C/MessageId\u003E\u003CInsertionTime\u003ETue, 26 Jan 2021 21:29:10 GMT\u003C/InsertionTime\u003E\u003CExpirationTime\u003ETue, 02 Feb 2021 21:29:10 GMT\u003C/ExpirationTime\u003E\u003CPopReceipt\u003EAgAAAAMAAAAAAAAANiLGSCr01gE=\u003C/PopReceipt\u003E\u003CTimeNextVisible\u003ETue, 26 Jan 2021 21:29:10 GMT\u003C/TimeNextVisible\u003E\u003C/QueueMessage\u003E\u003C/QueueMessagesList\u003E" + }, + { + "RequestUri": "https://kasoboltest.queue.core.windows.net/test-queue-1b097e93-0e7d-d7d2-f594-fa98802a79aa/messages", + "RequestMethod": "POST", + "RequestHeaders": { + "Accept": "application/xml", + "Authorization": "Sanitized", + "Content-Length": "75", + "Content-Type": "application/xml", + "traceparent": "00-851bc272403db24fb04b7725af0d6766-f45794e3a66cfb46-00", + "User-Agent": [ + "azsdk-net-Storage.Queues/12.7.0-alpha.20210126.1", + "(.NET Framework 4.8.4250.0; Microsoft Windows 10.0.19042 )" + ], + "x-ms-client-request-id": "fbe8e017-e05d-4f17-82de-eb41a0947d4b", + "x-ms-date": "Tue, 26 Jan 2021 21:29:10 GMT", + "x-ms-return-client-request-id": "true", + "x-ms-version": "2018-11-09" + }, + "RequestBody": "\uFEFF\u003CQueueMessage\u003E\u003CMessageText\u003EdGVzdF9jb250ZW50\u003C/MessageText\u003E\u003C/QueueMessage\u003E", + "StatusCode": 201, + "ResponseHeaders": { + "Content-Type": "application/xml", + "Date": "Tue, 26 Jan 2021 21:29:09 GMT", + "Server": [ + "Windows-Azure-Queue/1.0", + "Microsoft-HTTPAPI/2.0" + ], + "Transfer-Encoding": "chunked", + "x-ms-request-id": "0ad65d9b-8003-005d-482a-f4a4f7000000", + "x-ms-version": "2018-11-09" + }, + "ResponseBody": "\uFEFF\u003C?xml version=\u00221.0\u0022 encoding=\u0022utf-8\u0022?\u003E\u003CQueueMessagesList\u003E\u003CQueueMessage\u003E\u003CMessageId\u003E4f3267e9-b284-4b4e-869a-090091ad6bfc\u003C/MessageId\u003E\u003CInsertionTime\u003ETue, 26 Jan 2021 21:29:10 GMT\u003C/InsertionTime\u003E\u003CExpirationTime\u003ETue, 02 Feb 2021 21:29:10 GMT\u003C/ExpirationTime\u003E\u003CPopReceipt\u003EAgAAAAMAAAAAAAAA\u002BtDbSCr01gE=\u003C/PopReceipt\u003E\u003CTimeNextVisible\u003ETue, 26 Jan 2021 21:29:10 GMT\u003C/TimeNextVisible\u003E\u003C/QueueMessage\u003E\u003C/QueueMessagesList\u003E" + }, + { + "RequestUri": "https://kasoboltest.queue.core.windows.net/test-queue-1b097e93-0e7d-d7d2-f594-fa98802a79aa/messages?numofmessages=10", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "application/xml", + "Authorization": "Sanitized", + "traceparent": "00-0e8743f734fa1848a017d8dd33afcbab-cbea58ff368edc4b-00", + "User-Agent": [ + "azsdk-net-Storage.Queues/12.7.0-alpha.20210126.1", + "(.NET Framework 4.8.4250.0; Microsoft Windows 10.0.19042 )" + ], + "x-ms-client-request-id": "bbdbe9f6-9764-f3d4-27a0-c7a3e4b21a4b", + "x-ms-date": "Tue, 26 Jan 2021 21:29:10 GMT", + "x-ms-return-client-request-id": "true", + "x-ms-version": "2018-11-09" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "Cache-Control": "no-cache", + "Content-Type": "application/xml", + "Date": "Tue, 26 Jan 2021 21:29:09 GMT", + "Server": [ + "Windows-Azure-Queue/1.0", + "Microsoft-HTTPAPI/2.0" + ], + "Transfer-Encoding": "chunked", + "Vary": "Origin", + "x-ms-request-id": "0ad65da6-8003-005d-512a-f4a4f7000000", + "x-ms-version": "2018-11-09" + }, + "ResponseBody": "\uFEFF\u003C?xml version=\u00221.0\u0022 encoding=\u0022utf-8\u0022?\u003E\u003CQueueMessagesList\u003E\u003CQueueMessage\u003E\u003CMessageId\u003Eeafadc16-f4ca-4fc5-a43d-db377cee337f\u003C/MessageId\u003E\u003CInsertionTime\u003ETue, 26 Jan 2021 21:29:10 GMT\u003C/InsertionTime\u003E\u003CExpirationTime\u003ETue, 02 Feb 2021 21:29:10 GMT\u003C/ExpirationTime\u003E\u003CPopReceipt\u003EAgAAAAMAAAAAAAAA\u002Bn3CWir01gE=\u003C/PopReceipt\u003E\u003CTimeNextVisible\u003ETue, 26 Jan 2021 21:29:40 GMT\u003C/TimeNextVisible\u003E\u003CDequeueCount\u003E1\u003C/DequeueCount\u003E\u003CMessageText\u003Etest_content\u003C/MessageText\u003E\u003C/QueueMessage\u003E\u003CQueueMessage\u003E\u003CMessageId\u003E4f3267e9-b284-4b4e-869a-090091ad6bfc\u003C/MessageId\u003E\u003CInsertionTime\u003ETue, 26 Jan 2021 21:29:10 GMT\u003C/InsertionTime\u003E\u003CExpirationTime\u003ETue, 02 Feb 2021 21:29:10 GMT\u003C/ExpirationTime\u003E\u003CPopReceipt\u003EAgAAAAMAAAAAAAAA\u002Bn3CWir01gE=\u003C/PopReceipt\u003E\u003CTimeNextVisible\u003ETue, 26 Jan 2021 21:29:40 GMT\u003C/TimeNextVisible\u003E\u003CDequeueCount\u003E1\u003C/DequeueCount\u003E\u003CMessageText\u003EdGVzdF9jb250ZW50\u003C/MessageText\u003E\u003C/QueueMessage\u003E\u003C/QueueMessagesList\u003E" + }, + { + "RequestUri": "https://kasoboltest.queue.core.windows.net/test-queue-1b097e93-0e7d-d7d2-f594-fa98802a79aa", + "RequestMethod": "DELETE", + "RequestHeaders": { + "Accept": "application/xml", + "Authorization": "Sanitized", + "traceparent": "00-4b1baece1e2807488235024cb8166b5d-2f8945086ee8644c-00", + "User-Agent": [ + "azsdk-net-Storage.Queues/12.7.0-alpha.20210126.1", + "(.NET Framework 4.8.4250.0; Microsoft Windows 10.0.19042 )" + ], + "x-ms-client-request-id": "b74aaf97-c1b8-e3e7-3fe8-8ad37cd8fcc5", + "x-ms-date": "Tue, 26 Jan 2021 21:29:10 GMT", + "x-ms-return-client-request-id": "true", + "x-ms-version": "2018-11-09" + }, + "RequestBody": null, + "StatusCode": 204, + "ResponseHeaders": { + "Content-Length": "0", + "Date": "Tue, 26 Jan 2021 21:29:09 GMT", + "Server": [ + "Windows-Azure-Queue/1.0", + "Microsoft-HTTPAPI/2.0" + ], + "x-ms-request-id": "78b7a15d-b003-0011-622a-f463e8000000", + "x-ms-version": "2018-11-09" + }, + "ResponseBody": [] + } + ], + "Variables": { + "RandomSeed": "444016423", + "Storage_TestConfigDefault": "ProductionTenant\nkasoboltest\nU2FuaXRpemVk\nhttps://kasoboltest.blob.core.windows.net\nhttps://kasoboltest.file.core.windows.net\nhttps://kasoboltest.queue.core.windows.net\nhttps://kasoboltest.table.core.windows.net\n\n\n\n\nhttps://kasoboltest-secondary.blob.core.windows.net\nhttps://kasoboltest-secondary.file.core.windows.net\nhttps://kasoboltest-secondary.queue.core.windows.net\nhttps://kasoboltest-secondary.table.core.windows.net\n\nSanitized\n\n\nCloud\nBlobEndpoint=https://kasoboltest.blob.core.windows.net/;QueueEndpoint=https://kasoboltest.queue.core.windows.net/;FileEndpoint=https://kasoboltest.file.core.windows.net/;BlobSecondaryEndpoint=https://kasoboltest-secondary.blob.core.windows.net/;QueueSecondaryEndpoint=https://kasoboltest-secondary.queue.core.windows.net/;FileSecondaryEndpoint=https://kasoboltest-secondary.file.core.windows.net/;AccountName=kasoboltest;AccountKey=Kg==;\nencryptionScope" + } +} \ No newline at end of file diff --git a/sdk/storage/Azure.Storage.Queues/tests/SessionRecords/QueueClientTests/PropagatesExceptionIfInvalidQueueMessageAndHandlerThrowsAsync.json b/sdk/storage/Azure.Storage.Queues/tests/SessionRecords/QueueClientTests/PropagatesExceptionIfInvalidQueueMessageAndHandlerThrowsAsync.json new file mode 100644 index 0000000000000..e6aea433366e6 --- /dev/null +++ b/sdk/storage/Azure.Storage.Queues/tests/SessionRecords/QueueClientTests/PropagatesExceptionIfInvalidQueueMessageAndHandlerThrowsAsync.json @@ -0,0 +1,167 @@ +{ + "Entries": [ + { + "RequestUri": "https://kasoboltest.queue.core.windows.net/test-queue-bb1f8b18-605d-8e50-67f4-ee30c266a808", + "RequestMethod": "PUT", + "RequestHeaders": { + "Accept": "application/xml", + "Authorization": "Sanitized", + "traceparent": "00-69064aa0d59ac34ab45cc5dee0acd0cb-0125f1b056af1841-00", + "User-Agent": [ + "azsdk-net-Storage.Queues/12.7.0-alpha.20210126.1", + "(.NET Framework 4.8.4250.0; Microsoft Windows 10.0.19042 )" + ], + "x-ms-client-request-id": "384ec0f7-253a-0b24-117e-35e84bfa3933", + "x-ms-date": "Tue, 26 Jan 2021 21:29:10 GMT", + "x-ms-return-client-request-id": "true", + "x-ms-version": "2018-11-09" + }, + "RequestBody": null, + "StatusCode": 201, + "ResponseHeaders": { + "Content-Length": "0", + "Date": "Tue, 26 Jan 2021 21:29:09 GMT", + "Server": [ + "Windows-Azure-Queue/1.0", + "Microsoft-HTTPAPI/2.0" + ], + "x-ms-request-id": "31ad56f5-7003-002e-7b2a-f4d434000000", + "x-ms-version": "2018-11-09" + }, + "ResponseBody": [] + }, + { + "RequestUri": "https://kasoboltest.queue.core.windows.net/test-queue-bb1f8b18-605d-8e50-67f4-ee30c266a808/messages", + "RequestMethod": "POST", + "RequestHeaders": { + "Accept": "application/xml", + "Authorization": "Sanitized", + "Content-Length": "71", + "Content-Type": "application/xml", + "traceparent": "00-55b5469be9e87e4f8e3958911651442e-39fec4ce22a65a4c-00", + "User-Agent": [ + "azsdk-net-Storage.Queues/12.7.0-alpha.20210126.1", + "(.NET Framework 4.8.4250.0; Microsoft Windows 10.0.19042 )" + ], + "x-ms-client-request-id": "023964dc-6f18-ffcd-b64d-c21586b28ab9", + "x-ms-date": "Tue, 26 Jan 2021 21:29:10 GMT", + "x-ms-return-client-request-id": "true", + "x-ms-version": "2018-11-09" + }, + "RequestBody": "\uFEFF\u003CQueueMessage\u003E\u003CMessageText\u003Etest_content\u003C/MessageText\u003E\u003C/QueueMessage\u003E", + "StatusCode": 201, + "ResponseHeaders": { + "Content-Type": "application/xml", + "Date": "Tue, 26 Jan 2021 21:29:09 GMT", + "Server": [ + "Windows-Azure-Queue/1.0", + "Microsoft-HTTPAPI/2.0" + ], + "Transfer-Encoding": "chunked", + "x-ms-request-id": "31ad5715-7003-002e-172a-f4d434000000", + "x-ms-version": "2018-11-09" + }, + "ResponseBody": "\uFEFF\u003C?xml version=\u00221.0\u0022 encoding=\u0022utf-8\u0022?\u003E\u003CQueueMessagesList\u003E\u003CQueueMessage\u003E\u003CMessageId\u003Ef73b850a-d4e9-41e0-988f-d5224628bc50\u003C/MessageId\u003E\u003CInsertionTime\u003ETue, 26 Jan 2021 21:29:10 GMT\u003C/InsertionTime\u003E\u003CExpirationTime\u003ETue, 02 Feb 2021 21:29:10 GMT\u003C/ExpirationTime\u003E\u003CPopReceipt\u003EAgAAAAMAAAAAAAAALSkUSSr01gE=\u003C/PopReceipt\u003E\u003CTimeNextVisible\u003ETue, 26 Jan 2021 21:29:10 GMT\u003C/TimeNextVisible\u003E\u003C/QueueMessage\u003E\u003C/QueueMessagesList\u003E" + }, + { + "RequestUri": "https://kasoboltest.queue.core.windows.net/test-queue-bb1f8b18-605d-8e50-67f4-ee30c266a808/messages", + "RequestMethod": "POST", + "RequestHeaders": { + "Accept": "application/xml", + "Authorization": "Sanitized", + "Content-Length": "75", + "Content-Type": "application/xml", + "traceparent": "00-88434049c5bcf1489285ac51c2698273-ba2b2044bd15d44e-00", + "User-Agent": [ + "azsdk-net-Storage.Queues/12.7.0-alpha.20210126.1", + "(.NET Framework 4.8.4250.0; Microsoft Windows 10.0.19042 )" + ], + "x-ms-client-request-id": "e70c91e9-36c1-bb1b-851b-86a01fffd53e", + "x-ms-date": "Tue, 26 Jan 2021 21:29:10 GMT", + "x-ms-return-client-request-id": "true", + "x-ms-version": "2018-11-09" + }, + "RequestBody": "\uFEFF\u003CQueueMessage\u003E\u003CMessageText\u003EdGVzdF9jb250ZW50\u003C/MessageText\u003E\u003C/QueueMessage\u003E", + "StatusCode": 201, + "ResponseHeaders": { + "Content-Type": "application/xml", + "Date": "Tue, 26 Jan 2021 21:29:09 GMT", + "Server": [ + "Windows-Azure-Queue/1.0", + "Microsoft-HTTPAPI/2.0" + ], + "Transfer-Encoding": "chunked", + "x-ms-request-id": "85d1a784-3003-004f-412a-f490eb000000", + "x-ms-version": "2018-11-09" + }, + "ResponseBody": "\uFEFF\u003C?xml version=\u00221.0\u0022 encoding=\u0022utf-8\u0022?\u003E\u003CQueueMessagesList\u003E\u003CQueueMessage\u003E\u003CMessageId\u003E7ba418a2-ff21-4233-93e4-1bd947edf577\u003C/MessageId\u003E\u003CInsertionTime\u003ETue, 26 Jan 2021 21:29:10 GMT\u003C/InsertionTime\u003E\u003CExpirationTime\u003ETue, 02 Feb 2021 21:29:10 GMT\u003C/ExpirationTime\u003E\u003CPopReceipt\u003EAgAAAAMAAAAAAAAAWMYoSSr01gE=\u003C/PopReceipt\u003E\u003CTimeNextVisible\u003ETue, 26 Jan 2021 21:29:10 GMT\u003C/TimeNextVisible\u003E\u003C/QueueMessage\u003E\u003C/QueueMessagesList\u003E" + }, + { + "RequestUri": "https://kasoboltest.queue.core.windows.net/test-queue-bb1f8b18-605d-8e50-67f4-ee30c266a808/messages?numofmessages=10", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "application/xml", + "Authorization": "Sanitized", + "traceparent": "00-c891cfc5ad4b7b418af3a8a2a05c4d20-057e932f2b253a47-00", + "User-Agent": [ + "azsdk-net-Storage.Queues/12.7.0-alpha.20210126.1", + "(.NET Framework 4.8.4250.0; Microsoft Windows 10.0.19042 )" + ], + "x-ms-client-request-id": "f52cebd7-a3a5-fef8-7c2e-218c55f9f5ac", + "x-ms-date": "Tue, 26 Jan 2021 21:29:10 GMT", + "x-ms-return-client-request-id": "true", + "x-ms-version": "2018-11-09" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "Cache-Control": "no-cache", + "Content-Type": "application/xml", + "Date": "Tue, 26 Jan 2021 21:29:10 GMT", + "Server": [ + "Windows-Azure-Queue/1.0", + "Microsoft-HTTPAPI/2.0" + ], + "Transfer-Encoding": "chunked", + "Vary": "Origin", + "x-ms-request-id": "85d1a78e-3003-004f-492a-f490eb000000", + "x-ms-version": "2018-11-09" + }, + "ResponseBody": "\uFEFF\u003C?xml version=\u00221.0\u0022 encoding=\u0022utf-8\u0022?\u003E\u003CQueueMessagesList\u003E\u003CQueueMessage\u003E\u003CMessageId\u003Ef73b850a-d4e9-41e0-988f-d5224628bc50\u003C/MessageId\u003E\u003CInsertionTime\u003ETue, 26 Jan 2021 21:29:10 GMT\u003C/InsertionTime\u003E\u003CExpirationTime\u003ETue, 02 Feb 2021 21:29:10 GMT\u003C/ExpirationTime\u003E\u003CPopReceipt\u003EAgAAAAMAAAAAAAAANPoQWyr01gE=\u003C/PopReceipt\u003E\u003CTimeNextVisible\u003ETue, 26 Jan 2021 21:29:40 GMT\u003C/TimeNextVisible\u003E\u003CDequeueCount\u003E1\u003C/DequeueCount\u003E\u003CMessageText\u003Etest_content\u003C/MessageText\u003E\u003C/QueueMessage\u003E\u003CQueueMessage\u003E\u003CMessageId\u003E7ba418a2-ff21-4233-93e4-1bd947edf577\u003C/MessageId\u003E\u003CInsertionTime\u003ETue, 26 Jan 2021 21:29:10 GMT\u003C/InsertionTime\u003E\u003CExpirationTime\u003ETue, 02 Feb 2021 21:29:10 GMT\u003C/ExpirationTime\u003E\u003CPopReceipt\u003EAgAAAAMAAAAAAAAANPoQWyr01gE=\u003C/PopReceipt\u003E\u003CTimeNextVisible\u003ETue, 26 Jan 2021 21:29:40 GMT\u003C/TimeNextVisible\u003E\u003CDequeueCount\u003E1\u003C/DequeueCount\u003E\u003CMessageText\u003EdGVzdF9jb250ZW50\u003C/MessageText\u003E\u003C/QueueMessage\u003E\u003C/QueueMessagesList\u003E" + }, + { + "RequestUri": "https://kasoboltest.queue.core.windows.net/test-queue-bb1f8b18-605d-8e50-67f4-ee30c266a808", + "RequestMethod": "DELETE", + "RequestHeaders": { + "Accept": "application/xml", + "Authorization": "Sanitized", + "traceparent": "00-0e97a2defb3e854ba9a9e3ccf75ac015-1a2b0803018adf41-00", + "User-Agent": [ + "azsdk-net-Storage.Queues/12.7.0-alpha.20210126.1", + "(.NET Framework 4.8.4250.0; Microsoft Windows 10.0.19042 )" + ], + "x-ms-client-request-id": "34c90439-dfd2-1b98-56bd-8123cd6fabd0", + "x-ms-date": "Tue, 26 Jan 2021 21:29:10 GMT", + "x-ms-return-client-request-id": "true", + "x-ms-version": "2018-11-09" + }, + "RequestBody": null, + "StatusCode": 204, + "ResponseHeaders": { + "Content-Length": "0", + "Date": "Tue, 26 Jan 2021 21:29:09 GMT", + "Server": [ + "Windows-Azure-Queue/1.0", + "Microsoft-HTTPAPI/2.0" + ], + "x-ms-request-id": "31ad57bb-7003-002e-3c2a-f4d434000000", + "x-ms-version": "2018-11-09" + }, + "ResponseBody": [] + } + ], + "Variables": { + "RandomSeed": "2008412009", + "Storage_TestConfigDefault": "ProductionTenant\nkasoboltest\nU2FuaXRpemVk\nhttps://kasoboltest.blob.core.windows.net\nhttps://kasoboltest.file.core.windows.net\nhttps://kasoboltest.queue.core.windows.net\nhttps://kasoboltest.table.core.windows.net\n\n\n\n\nhttps://kasoboltest-secondary.blob.core.windows.net\nhttps://kasoboltest-secondary.file.core.windows.net\nhttps://kasoboltest-secondary.queue.core.windows.net\nhttps://kasoboltest-secondary.table.core.windows.net\n\nSanitized\n\n\nCloud\nBlobEndpoint=https://kasoboltest.blob.core.windows.net/;QueueEndpoint=https://kasoboltest.queue.core.windows.net/;FileEndpoint=https://kasoboltest.file.core.windows.net/;BlobSecondaryEndpoint=https://kasoboltest-secondary.blob.core.windows.net/;QueueSecondaryEndpoint=https://kasoboltest-secondary.queue.core.windows.net/;FileSecondaryEndpoint=https://kasoboltest-secondary.file.core.windows.net/;AccountName=kasoboltest;AccountKey=Kg==;\nencryptionScope" + } +} \ No newline at end of file From 918349fb8c17b4a739213450ad9efa830ef5435e Mon Sep 17 00:00:00 2001 From: Kamil Sobol Date: Tue, 26 Jan 2021 14:05:20 -0800 Subject: [PATCH 17/27] readme. --- sdk/storage/Azure.Storage.Queues/README.md | 56 ++++++++++++++++ .../samples/Sample03_MessageEncoding.cs | 64 +++++++++++++++++++ 2 files changed, 120 insertions(+) create mode 100644 sdk/storage/Azure.Storage.Queues/samples/Sample03_MessageEncoding.cs diff --git a/sdk/storage/Azure.Storage.Queues/README.md b/sdk/storage/Azure.Storage.Queues/README.md index 0988eec54c401..60150ada99178 100644 --- a/sdk/storage/Azure.Storage.Queues/README.md +++ b/sdk/storage/Azure.Storage.Queues/README.md @@ -125,6 +125,62 @@ QueueClient queue = new QueueClient(accountUri, new DefaultAzureCredential()); Learn more about enabling Azure Active Directory for authentication with Azure Storage in [our documentation][storage_ad] and [our samples](#next-steps). +### Message encoding + +This version of library does not encode message by default. V11 and prior versions base64-encoded messages by default. +This section shows how message encoding can be customized as well as additional error handling can be provided for poison messages. + +#### Configuration + +```C# Snippet:Azure_Storage_Queues_Samples_Sample03_MessageEncoding_ConfigureMessageEncodingAsync +QueueClientOptions queueClientOptions = new QueueClientOptions() +{ + MessageEncoding = QueueMessageEncoding.Base64 +}; + +QueueClient queueClient = new QueueClient(connectionString, queueName, queueClientOptions); +``` + +#### Poison messages + +We provide ability to define handler for situations where queue might contain messages that don't align with encoding setting configured in `QueueClientOptions`. +The handler gives access to message and its raw body. We don't delete message from queue, therefore handler logic should do that if desired. + +The handler is potentially invoked by both synchronous and asynchronous receive and peek APIs. Therefore implementation of the handler should align with `QueueClient` APIs that are being used. +See [more](https://github.com/Azure/azure-sdk-for-net/blob/master/sdk/core/Azure.Core/samples/Events.md) about how to implement handler correctly. + +The example below shows a handler with all possible cases explored. + +```C# Snippet:Azure_Storage_Queues_Samples_Sample03_MessageEncoding_InvalidMessageHandlerAsync +QueueClientOptions queueClientOptions = new QueueClientOptions() +{ + MessageEncoding = QueueMessageEncoding.Base64 +}; + +queueClientOptions.OnInvalidMessage += async (InvalidMessageEventArgs args) => +{ + if (args.Message is PeekedMessage peekedMessage) + { + Console.WriteLine($"Invalid message has been peeked, message id={peekedMessage.MessageId} body={peekedMessage.Body}"); + } else if (args.Message is QueueMessage queueMessage) + { + Console.WriteLine($"Invalid message has been received, message id={queueMessage.MessageId} body={queueMessage.Body}"); + + if (args.RunSynchronously) + { + args.Queue.DeleteMessage(queueMessage.MessageId, queueMessage.PopReceipt); + } + else + { + await args.Queue.DeleteMessageAsync(queueMessage.MessageId, queueMessage.PopReceipt); + } + } +}; + +QueueClient queueClient = new QueueClient(connectionString, queueName, queueClientOptions); +``` + + ## Troubleshooting All Azure Storage Queue service operations will throw a diff --git a/sdk/storage/Azure.Storage.Queues/samples/Sample03_MessageEncoding.cs b/sdk/storage/Azure.Storage.Queues/samples/Sample03_MessageEncoding.cs new file mode 100644 index 0000000000000..554a6f4772604 --- /dev/null +++ b/sdk/storage/Azure.Storage.Queues/samples/Sample03_MessageEncoding.cs @@ -0,0 +1,64 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System; +using Azure.Storage.Queues.Models; +using NUnit.Framework; + +namespace Azure.Storage.Queues.Samples.Tests +{ + public class Sample03_MessageEncoding : SampleTest + { + [Test] + public void ConfigureMessageEncodingAsync() + { + var connectionString = ConnectionString; + var queueName = "foo"; + #region Snippet:Azure_Storage_Queues_Samples_Sample03_MessageEncoding_ConfigureMessageEncodingAsync + + QueueClientOptions queueClientOptions = new QueueClientOptions() + { + MessageEncoding = QueueMessageEncoding.Base64 + }; + + QueueClient queueClient = new QueueClient(connectionString, queueName, queueClientOptions); + #endregion + } + + [Test] + public void InvalidMessageHandlerAsync() + { + var connectionString = ConnectionString; + var queueName = "foo"; + #region Snippet:Azure_Storage_Queues_Samples_Sample03_MessageEncoding_InvalidMessageHandlerAsync + + QueueClientOptions queueClientOptions = new QueueClientOptions() + { + MessageEncoding = QueueMessageEncoding.Base64 + }; + + queueClientOptions.OnInvalidMessage += async (InvalidMessageEventArgs args) => + { + if (args.Message is PeekedMessage peekedMessage) + { + Console.WriteLine($"Invalid message has been peeked, message id={peekedMessage.MessageId} body={peekedMessage.Body}"); + } else if (args.Message is QueueMessage queueMessage) + { + Console.WriteLine($"Invalid message has been received, message id={queueMessage.MessageId} body={queueMessage.Body}"); + + if (args.RunSynchronously) + { + args.Queue.DeleteMessage(queueMessage.MessageId, queueMessage.PopReceipt); + } + else + { + await args.Queue.DeleteMessageAsync(queueMessage.MessageId, queueMessage.PopReceipt); + } + } + }; + + QueueClient queueClient = new QueueClient(connectionString, queueName, queueClientOptions); + #endregion + } + } +} From ea14fa124f6a703c82663fa4b477e64d6ab3571f Mon Sep 17 00:00:00 2001 From: Kamil Sobol Date: Tue, 26 Jan 2021 14:08:58 -0800 Subject: [PATCH 18/27] whitespace. --- sdk/storage/Azure.Storage.Queues/README.md | 3 ++- .../Azure.Storage.Queues/samples/Sample03_MessageEncoding.cs | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/sdk/storage/Azure.Storage.Queues/README.md b/sdk/storage/Azure.Storage.Queues/README.md index 60150ada99178..7f0ba9702fcd0 100644 --- a/sdk/storage/Azure.Storage.Queues/README.md +++ b/sdk/storage/Azure.Storage.Queues/README.md @@ -162,7 +162,8 @@ queueClientOptions.OnInvalidMessage += async (InvalidMessageEventArgs args) => if (args.Message is PeekedMessage peekedMessage) { Console.WriteLine($"Invalid message has been peeked, message id={peekedMessage.MessageId} body={peekedMessage.Body}"); - } else if (args.Message is QueueMessage queueMessage) + } + else if (args.Message is QueueMessage queueMessage) { Console.WriteLine($"Invalid message has been received, message id={queueMessage.MessageId} body={queueMessage.Body}"); diff --git a/sdk/storage/Azure.Storage.Queues/samples/Sample03_MessageEncoding.cs b/sdk/storage/Azure.Storage.Queues/samples/Sample03_MessageEncoding.cs index 554a6f4772604..9f2ebac2150a0 100644 --- a/sdk/storage/Azure.Storage.Queues/samples/Sample03_MessageEncoding.cs +++ b/sdk/storage/Azure.Storage.Queues/samples/Sample03_MessageEncoding.cs @@ -42,7 +42,8 @@ public void InvalidMessageHandlerAsync() if (args.Message is PeekedMessage peekedMessage) { Console.WriteLine($"Invalid message has been peeked, message id={peekedMessage.MessageId} body={peekedMessage.Body}"); - } else if (args.Message is QueueMessage queueMessage) + } + else if (args.Message is QueueMessage queueMessage) { Console.WriteLine($"Invalid message has been received, message id={queueMessage.MessageId} body={queueMessage.Body}"); From 27fb680e32372226d2cdcf94bf91edacb4e4e7e9 Mon Sep 17 00:00:00 2001 From: Kamil Sobol Date: Wed, 27 Jan 2021 15:38:43 -0800 Subject: [PATCH 19/27] some pr feedback. --- .../samples/Sample03_MessageEncoding.cs | 4 +-- .../src/InvalidMessageEventArgs.cs | 22 +++++++-------- .../Azure.Storage.Queues/src/QueueClient.cs | 27 +++++-------------- 3 files changed, 19 insertions(+), 34 deletions(-) diff --git a/sdk/storage/Azure.Storage.Queues/samples/Sample03_MessageEncoding.cs b/sdk/storage/Azure.Storage.Queues/samples/Sample03_MessageEncoding.cs index 9f2ebac2150a0..a271e0238f3c8 100644 --- a/sdk/storage/Azure.Storage.Queues/samples/Sample03_MessageEncoding.cs +++ b/sdk/storage/Azure.Storage.Queues/samples/Sample03_MessageEncoding.cs @@ -49,11 +49,11 @@ public void InvalidMessageHandlerAsync() if (args.RunSynchronously) { - args.Queue.DeleteMessage(queueMessage.MessageId, queueMessage.PopReceipt); + args.QueueClient.DeleteMessage(queueMessage.MessageId, queueMessage.PopReceipt); } else { - await args.Queue.DeleteMessageAsync(queueMessage.MessageId, queueMessage.PopReceipt); + await args.QueueClient.DeleteMessageAsync(queueMessage.MessageId, queueMessage.PopReceipt); } } }; diff --git a/sdk/storage/Azure.Storage.Queues/src/InvalidMessageEventArgs.cs b/sdk/storage/Azure.Storage.Queues/src/InvalidMessageEventArgs.cs index 6f8c895131391..d5874bbeafda7 100644 --- a/sdk/storage/Azure.Storage.Queues/src/InvalidMessageEventArgs.cs +++ b/sdk/storage/Azure.Storage.Queues/src/InvalidMessageEventArgs.cs @@ -16,7 +16,7 @@ public class InvalidMessageEventArgs : SyncAsyncEventArgs /// /// Gets the that has received invalid message. /// - public QueueClient Queue { get; } + public QueueClient QueueClient { get; } /// /// Gets the invalid message which can be either or . @@ -27,7 +27,7 @@ public class InvalidMessageEventArgs : SyncAsyncEventArgs /// /// Initializes a new instance of the . /// - /// The that has received invalid message. + /// The that has received invalid message. /// The invalid message. /// /// A value indicating whether the event handler was invoked @@ -42,26 +42,26 @@ public class InvalidMessageEventArgs : SyncAsyncEventArgs /// default value is . /// /// - /// Thrown if or + /// Thrown if or /// are null. /// public InvalidMessageEventArgs( - QueueClient queue, + QueueClient queueClient, QueueMessage message, bool runSynchronously, CancellationToken cancellationToken) : base(runSynchronously, cancellationToken) { - Argument.AssertNotNull(queue, nameof(queue)); + Argument.AssertNotNull(queueClient, nameof(queueClient)); Argument.AssertNotNull(message, nameof(message)); - Queue = queue; + QueueClient = queueClient; Message = message; } /// /// Initializes a new instance of the . /// - /// The that has received invalid message. + /// The that has received invalid message. /// The invalid message. /// /// A value indicating whether the event handler was invoked @@ -76,19 +76,19 @@ public InvalidMessageEventArgs( /// default value is . /// /// - /// Thrown if or + /// Thrown if or /// are null. /// public InvalidMessageEventArgs( - QueueClient queue, + QueueClient queueClient, PeekedMessage message, bool runSynchronously, CancellationToken cancellationToken) : base(runSynchronously, cancellationToken) { - Argument.AssertNotNull(queue, nameof(queue)); + Argument.AssertNotNull(queueClient, nameof(queueClient)); Argument.AssertNotNull(message, nameof(message)); - Queue = queue; + QueueClient = queueClient; Message = message; } } diff --git a/sdk/storage/Azure.Storage.Queues/src/QueueClient.cs b/sdk/storage/Azure.Storage.Queues/src/QueueClient.cs index 1d7a416c2fc3d..5cccf3043ce6f 100644 --- a/sdk/storage/Azure.Storage.Queues/src/QueueClient.cs +++ b/sdk/storage/Azure.Storage.Queues/src/QueueClient.cs @@ -2203,14 +2203,7 @@ private async Task> ReceiveMessagesInternal( return response.GetRawResponse().AsNoBodyResponse(); } else { - QueueMessage[] queueMessages; - if (ClientConfiguration.InvalidMessageHandler != null) - { - queueMessages = await ToQueueMessagesWithInvalidMessageHandling(response.Value, async, cancellationToken).ConfigureAwait(false); - } else - { - queueMessages = response.Value.Select(x => QueueMessage.ToQueueMessage(x, ClientConfiguration.MessageEncoding)).ToArray(); - } + QueueMessage[] queueMessages = await ToQueueMessagesWithInvalidMessageHandling(response.Value, async, cancellationToken).ConfigureAwait(false); if (UsingClientSideEncryption) { @@ -2252,12 +2245,12 @@ private async Task ToQueueMessagesWithInvalidMessageHandling( { queueMessages.Add(QueueMessage.ToQueueMessage(dequeuedMessageItem, ClientConfiguration.MessageEncoding)); } - catch (FormatException) + catch (FormatException) when (ClientConfiguration.InvalidMessageHandler != null) { #pragma warning disable AZC0110 // DO NOT use await keyword in possibly synchronous scope. await ClientConfiguration.InvalidMessageHandler.RaiseAsync( new InvalidMessageEventArgs( - queue: this, + queueClient: this, message: QueueMessage.ToQueueMessage(dequeuedMessageItem, QueueMessageEncoding.None), runSynchronously: !async, cancellationToken: cancellationToken), @@ -2562,15 +2555,7 @@ private async Task> PeekMessagesInternal( } else { - PeekedMessage[] peekedMessages; - if (ClientConfiguration.InvalidMessageHandler != null) - { - peekedMessages = await ToPeekedMessagesWithInvalidMessageHandling(response.Value, async, cancellationToken).ConfigureAwait(false); - } - else - { - peekedMessages = response.Value.Select(x => PeekedMessage.ToPeekedMessage(x, ClientConfiguration.MessageEncoding)).ToArray(); - } + PeekedMessage[] peekedMessages = await ToPeekedMessagesWithInvalidMessageHandling(response.Value, async, cancellationToken).ConfigureAwait(false); if (UsingClientSideEncryption) { @@ -2612,12 +2597,12 @@ private async Task ToPeekedMessagesWithInvalidMessageHandling( { peekedMessages.Add(PeekedMessage.ToPeekedMessage(peekedMessageItem, ClientConfiguration.MessageEncoding)); } - catch (FormatException) + catch (FormatException) when (ClientConfiguration.InvalidMessageHandler != null) { #pragma warning disable AZC0110 // DO NOT use await keyword in possibly synchronous scope. await ClientConfiguration.InvalidMessageHandler.RaiseAsync( new InvalidMessageEventArgs( - queue: this, + queueClient: this, message: PeekedMessage.ToPeekedMessage(peekedMessageItem, QueueMessageEncoding.None), runSynchronously: !async, cancellationToken: cancellationToken), From 8eb362ef75f45769d494ea42e02ab266ec8f6b05 Mon Sep 17 00:00:00 2001 From: Kamil Sobol Date: Wed, 27 Jan 2021 15:40:00 -0800 Subject: [PATCH 20/27] api --- .../api/Azure.Storage.Queues.netstandard2.0.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sdk/storage/Azure.Storage.Queues/api/Azure.Storage.Queues.netstandard2.0.cs b/sdk/storage/Azure.Storage.Queues/api/Azure.Storage.Queues.netstandard2.0.cs index 917818b840316..28702f6c76417 100644 --- a/sdk/storage/Azure.Storage.Queues/api/Azure.Storage.Queues.netstandard2.0.cs +++ b/sdk/storage/Azure.Storage.Queues/api/Azure.Storage.Queues.netstandard2.0.cs @@ -2,10 +2,10 @@ namespace Azure.Storage.Queues { public partial class InvalidMessageEventArgs : Azure.SyncAsyncEventArgs { - public InvalidMessageEventArgs(Azure.Storage.Queues.QueueClient queue, Azure.Storage.Queues.Models.PeekedMessage message, bool runSynchronously, System.Threading.CancellationToken cancellationToken) : base (default(bool), default(System.Threading.CancellationToken)) { } - public InvalidMessageEventArgs(Azure.Storage.Queues.QueueClient queue, Azure.Storage.Queues.Models.QueueMessage message, bool runSynchronously, System.Threading.CancellationToken cancellationToken) : base (default(bool), default(System.Threading.CancellationToken)) { } + public InvalidMessageEventArgs(Azure.Storage.Queues.QueueClient queueClient, Azure.Storage.Queues.Models.PeekedMessage message, bool runSynchronously, System.Threading.CancellationToken cancellationToken) : base (default(bool), default(System.Threading.CancellationToken)) { } + public InvalidMessageEventArgs(Azure.Storage.Queues.QueueClient queueClient, Azure.Storage.Queues.Models.QueueMessage message, bool runSynchronously, System.Threading.CancellationToken cancellationToken) : base (default(bool), default(System.Threading.CancellationToken)) { } public object Message { get { throw null; } } - public Azure.Storage.Queues.QueueClient Queue { get { throw null; } } + public Azure.Storage.Queues.QueueClient QueueClient { get { throw null; } } } public partial class QueueClient { From 23c52142614bb196a5bcdbeafa10714a6b39d7d2 Mon Sep 17 00:00:00 2001 From: Kamil Sobol Date: Wed, 27 Jan 2021 16:39:21 -0800 Subject: [PATCH 21/27] get parent queue service. --- .../Azure.Storage.Queues.netstandard2.0.cs | 2 + .../Azure.Storage.Queues/src/QueueClient.cs | 42 ++++++++ .../src/QueueServiceClient.cs | 22 ++++ .../tests/QueueClientTests.cs | 51 +++++++++ .../CanGetParentQueueServiceClient.json | 101 ++++++++++++++++++ .../CanGetParentQueueServiceClientAsync.json | 101 ++++++++++++++++++ ...rentQueueServiceClient_WithAccountSAS.json | 40 +++++++ ...ueueServiceClient_WithAccountSASAsync.json | 40 +++++++ .../CanMockQueueServiceClientRetrieval.json | 4 + ...nMockQueueServiceClientRetrievalAsync.json | 4 + 10 files changed, 407 insertions(+) create mode 100644 sdk/storage/Azure.Storage.Queues/tests/SessionRecords/QueueClientTests/CanGetParentQueueServiceClient.json create mode 100644 sdk/storage/Azure.Storage.Queues/tests/SessionRecords/QueueClientTests/CanGetParentQueueServiceClientAsync.json create mode 100644 sdk/storage/Azure.Storage.Queues/tests/SessionRecords/QueueClientTests/CanGetParentQueueServiceClient_WithAccountSAS.json create mode 100644 sdk/storage/Azure.Storage.Queues/tests/SessionRecords/QueueClientTests/CanGetParentQueueServiceClient_WithAccountSASAsync.json create mode 100644 sdk/storage/Azure.Storage.Queues/tests/SessionRecords/QueueClientTests/CanMockQueueServiceClientRetrieval.json create mode 100644 sdk/storage/Azure.Storage.Queues/tests/SessionRecords/QueueClientTests/CanMockQueueServiceClientRetrievalAsync.json diff --git a/sdk/storage/Azure.Storage.Queues/api/Azure.Storage.Queues.netstandard2.0.cs b/sdk/storage/Azure.Storage.Queues/api/Azure.Storage.Queues.netstandard2.0.cs index 28702f6c76417..7a81916b8c4cc 100644 --- a/sdk/storage/Azure.Storage.Queues/api/Azure.Storage.Queues.netstandard2.0.cs +++ b/sdk/storage/Azure.Storage.Queues/api/Azure.Storage.Queues.netstandard2.0.cs @@ -41,6 +41,7 @@ public QueueClient(System.Uri queueUri, Azure.Storage.StorageSharedKeyCredential public virtual System.Uri GenerateSasUri(Azure.Storage.Sas.QueueSasPermissions permissions, System.DateTimeOffset expiresOn) { throw null; } public virtual Azure.Response> GetAccessPolicy(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task>> GetAccessPolicyAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + protected internal virtual Azure.Storage.Queues.QueueServiceClient GetParentQueueServiceClientCore() { throw null; } public virtual Azure.Response GetProperties(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task> GetPropertiesAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Response PeekMessage(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } @@ -376,6 +377,7 @@ public SpecializedQueueClientOptions(Azure.Storage.Queues.QueueClientOptions.Ser } public static partial class SpecializedQueueExtensions { + public static Azure.Storage.Queues.QueueServiceClient GetParentQueueServiceClient(this Azure.Storage.Queues.QueueClient client) { throw null; } public static Azure.Storage.Queues.QueueClient WithClientSideEncryptionOptions(this Azure.Storage.Queues.QueueClient client, Azure.Storage.ClientSideEncryptionOptions clientSideEncryptionOptions) { throw null; } } } diff --git a/sdk/storage/Azure.Storage.Queues/src/QueueClient.cs b/sdk/storage/Azure.Storage.Queues/src/QueueClient.cs index 5cccf3043ce6f..f4b6560b8e5e0 100644 --- a/sdk/storage/Azure.Storage.Queues/src/QueueClient.cs +++ b/sdk/storage/Azure.Storage.Queues/src/QueueClient.cs @@ -3166,6 +3166,36 @@ private void AssertEncodingForEncryption() } } #endregion Encoding + + #region GetParentQueueServiceClientCore + + private QueueServiceClient _parentQueueServiceClient; + + /// + /// Create a new that pointing to this 's queue service. + /// The new + /// uses the same request policy pipeline as the + /// . + /// + /// A new instance. + protected internal virtual QueueServiceClient GetParentQueueServiceClientCore() + { + if (_parentQueueServiceClient == null) + { + QueueUriBuilder queueUriBuilder = new QueueUriBuilder(Uri) + { + // erase parameters unrelated to service + QueueName = null, + }; + + _parentQueueServiceClient = new QueueServiceClient( + queueUriBuilder.ToUri(), + ClientConfiguration); + } + + return _parentQueueServiceClient; + } + #endregion } } @@ -3185,5 +3215,17 @@ public static partial class SpecializedQueueExtensions /// New instance with provided options and same internals otherwise. public static QueueClient WithClientSideEncryptionOptions(this QueueClient client, ClientSideEncryptionOptions clientSideEncryptionOptions) => client.WithClientSideEncryptionOptionsCore(clientSideEncryptionOptions); + + /// + /// Create a new that pointing to this 's queue service. + /// The new + /// uses the same request policy pipeline as the + /// . + /// + /// A new instance. + public static QueueServiceClient GetParentQueueServiceClient(this QueueClient client) + { + return client.GetParentQueueServiceClientCore(); + } } } diff --git a/sdk/storage/Azure.Storage.Queues/src/QueueServiceClient.cs b/sdk/storage/Azure.Storage.Queues/src/QueueServiceClient.cs index bfdcdfa2bf91e..36d8f35b496cf 100644 --- a/sdk/storage/Azure.Storage.Queues/src/QueueServiceClient.cs +++ b/sdk/storage/Azure.Storage.Queues/src/QueueServiceClient.cs @@ -264,6 +264,28 @@ internal QueueServiceClient( _serviceRestClient = BuildServiceRestClient(); } + /// + /// Initializes a new instance of the + /// class. + /// + /// + /// A referencing the queue service. + /// This is likely to be similar to "https://{account_name}.queue.core.windows.net". + /// + /// + /// . + /// + internal QueueServiceClient( + Uri serviceUri, + QueueClientConfiguration clientConfiguration) + { + Argument.AssertNotNull(serviceUri, nameof(serviceUri)); + Argument.AssertNotNull(clientConfiguration, nameof(clientConfiguration)); + _uri = serviceUri; + _clientConfiguration = clientConfiguration; + _serviceRestClient = BuildServiceRestClient(); + } + private ServiceRestClient BuildServiceRestClient() => new ServiceRestClient( _clientConfiguration.ClientDiagnostics, diff --git a/sdk/storage/Azure.Storage.Queues/tests/QueueClientTests.cs b/sdk/storage/Azure.Storage.Queues/tests/QueueClientTests.cs index 33178460f5f85..d4dd0819ca2d6 100644 --- a/sdk/storage/Azure.Storage.Queues/tests/QueueClientTests.cs +++ b/sdk/storage/Azure.Storage.Queues/tests/QueueClientTests.cs @@ -17,6 +17,8 @@ using Moq; using System.Threading; using System.Runtime.InteropServices; +using Azure.Storage.Queues.Specialized; +using Moq.Protected; namespace Azure.Storage.Queues.Test { @@ -1683,6 +1685,55 @@ public void GenerateSas_BuilderWrongName() } #endregion + [Test] + public void CanMockQueueServiceClientRetrieval() + { + // Arrange + Mock queueClientMock = new Mock(); + Mock queueServiceClientMock = new Mock(); + queueClientMock.Protected().Setup("GetParentQueueServiceClientCore").Returns(queueServiceClientMock.Object); + + // Act + var queueServiceClient = queueClientMock.Object.GetParentQueueServiceClient(); + + // Assert + Assert.IsNotNull(queueServiceClient); + Assert.AreSame(queueServiceClientMock.Object, queueServiceClient); + } + + [Test] + public async Task CanGetParentQueueServiceClient() + { + // Arrange + await using DisposingQueue test = await GetTestQueueAsync(); + + // Act + var queueServiceClient = test.Queue.GetParentQueueServiceClient(); + // make sure that client is functional + QueueServiceProperties queueServiceProperties = await queueServiceClient.GetPropertiesAsync(); + + // Assert + Assert.AreEqual(test.Queue.AccountName, queueServiceClient.AccountName); + } + + [Test] + public async Task CanGetParentQueueServiceClient_WithAccountSAS() + { + // Arrange + QueueClient queueClient = InstrumentClient( + GetServiceClient_AccountSas( + sasCredentials: GetNewAccountSasCredentials(resourceTypes: AccountSasResourceTypes.All)) + .GetQueueClient(GetNewQueueName())); + + // Act + var queueServiceClient = queueClient.GetParentQueueServiceClient(); + // make sure that client is functional + QueueServiceProperties queueServiceProperties = await queueServiceClient.GetPropertiesAsync(); + + // Assert + Assert.AreEqual(queueClient.AccountName, queueServiceClient.AccountName); + } + [Test] public void CanMockClientConstructors() { diff --git a/sdk/storage/Azure.Storage.Queues/tests/SessionRecords/QueueClientTests/CanGetParentQueueServiceClient.json b/sdk/storage/Azure.Storage.Queues/tests/SessionRecords/QueueClientTests/CanGetParentQueueServiceClient.json new file mode 100644 index 0000000000000..68633a616766b --- /dev/null +++ b/sdk/storage/Azure.Storage.Queues/tests/SessionRecords/QueueClientTests/CanGetParentQueueServiceClient.json @@ -0,0 +1,101 @@ +{ + "Entries": [ + { + "RequestUri": "https://kasoboltest.queue.core.windows.net/test-queue-eb583422-be3e-04a5-2b84-9b268aba2444", + "RequestMethod": "PUT", + "RequestHeaders": { + "Accept": "application/xml", + "Authorization": "Sanitized", + "traceparent": "00-bee466e23f8d3c44bb30ee41e9a0252a-3b1488b4664bec47-00", + "User-Agent": [ + "azsdk-net-Storage.Queues/12.7.0-alpha.20210127.1", + "(.NET Framework 4.8.4250.0; Microsoft Windows 10.0.19042 )" + ], + "x-ms-client-request-id": "f5dbabfe-0675-9d9b-8603-f26310798aab", + "x-ms-date": "Thu, 28 Jan 2021 00:29:47 GMT", + "x-ms-return-client-request-id": "true", + "x-ms-version": "2018-11-09" + }, + "RequestBody": null, + "StatusCode": 201, + "ResponseHeaders": { + "Content-Length": "0", + "Date": "Thu, 28 Jan 2021 00:29:47 GMT", + "Server": [ + "Windows-Azure-Queue/1.0", + "Microsoft-HTTPAPI/2.0" + ], + "x-ms-request-id": "e015b8db-5003-0039-770c-f51457000000", + "x-ms-version": "2018-11-09" + }, + "ResponseBody": [] + }, + { + "RequestUri": "https://kasoboltest.queue.core.windows.net/?restype=service\u0026comp=properties", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "application/xml", + "Authorization": "Sanitized", + "traceparent": "00-31d73b8fa0613942a50098e038e446ad-c23b83930dbce049-00", + "User-Agent": [ + "azsdk-net-Storage.Queues/12.7.0-alpha.20210127.1", + "(.NET Framework 4.8.4250.0; Microsoft Windows 10.0.19042 )" + ], + "x-ms-client-request-id": "df282ce3-2edf-03ce-af70-625c4e1a0ba5", + "x-ms-date": "Thu, 28 Jan 2021 00:29:47 GMT", + "x-ms-return-client-request-id": "true", + "x-ms-version": "2018-11-09" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "Cache-Control": "no-cache", + "Content-Type": "application/xml", + "Date": "Thu, 28 Jan 2021 00:29:47 GMT", + "Server": [ + "Windows-Azure-Queue/1.0", + "Microsoft-HTTPAPI/2.0" + ], + "Transfer-Encoding": "chunked", + "Vary": "Origin", + "x-ms-request-id": "e015b8f9-5003-0039-0f0c-f51457000000", + "x-ms-version": "2018-11-09" + }, + "ResponseBody": "\uFEFF\u003C?xml version=\u00221.0\u0022 encoding=\u0022utf-8\u0022?\u003E\u003CStorageServiceProperties\u003E\u003CLogging\u003E\u003CVersion\u003E1.0\u003C/Version\u003E\u003CRead\u003Etrue\u003C/Read\u003E\u003CWrite\u003Etrue\u003C/Write\u003E\u003CDelete\u003Efalse\u003C/Delete\u003E\u003CRetentionPolicy\u003E\u003CEnabled\u003Etrue\u003C/Enabled\u003E\u003CDays\u003E5\u003C/Days\u003E\u003C/RetentionPolicy\u003E\u003C/Logging\u003E\u003CHourMetrics\u003E\u003CVersion\u003E1.0\u003C/Version\u003E\u003CEnabled\u003Etrue\u003C/Enabled\u003E\u003CIncludeAPIs\u003Efalse\u003C/IncludeAPIs\u003E\u003CRetentionPolicy\u003E\u003CEnabled\u003Etrue\u003C/Enabled\u003E\u003CDays\u003E6\u003C/Days\u003E\u003C/RetentionPolicy\u003E\u003C/HourMetrics\u003E\u003CMinuteMetrics\u003E\u003CVersion\u003E1.0\u003C/Version\u003E\u003CEnabled\u003Etrue\u003C/Enabled\u003E\u003CIncludeAPIs\u003Efalse\u003C/IncludeAPIs\u003E\u003CRetentionPolicy\u003E\u003CEnabled\u003Etrue\u003C/Enabled\u003E\u003CDays\u003E6\u003C/Days\u003E\u003C/RetentionPolicy\u003E\u003C/MinuteMetrics\u003E\u003CCors\u003E\u003CCorsRule\u003E\u003CAllowedMethods\u003EGET,PUT\u003C/AllowedMethods\u003E\u003CAllowedOrigins\u003Ewww.ab.com,www.bc.com\u003C/AllowedOrigins\u003E\u003CAllowedHeaders\u003Ex-ms-meta-xyz,x-ms-meta-foo,x-ms-meta-data*,x-ms-meta-target*\u003C/AllowedHeaders\u003E\u003CExposedHeaders\u003Ex-ms-meta-abc,x-ms-meta-bcd,x-ms-meta-data*,x-ms-meta-source*\u003C/ExposedHeaders\u003E\u003CMaxAgeInSeconds\u003E500\u003C/MaxAgeInSeconds\u003E\u003C/CorsRule\u003E\u003C/Cors\u003E\u003C/StorageServiceProperties\u003E" + }, + { + "RequestUri": "https://kasoboltest.queue.core.windows.net/test-queue-eb583422-be3e-04a5-2b84-9b268aba2444", + "RequestMethod": "DELETE", + "RequestHeaders": { + "Accept": "application/xml", + "Authorization": "Sanitized", + "traceparent": "00-21b891edfdccfc418a5a82482b5f857c-53b654d9e9f3b94d-00", + "User-Agent": [ + "azsdk-net-Storage.Queues/12.7.0-alpha.20210127.1", + "(.NET Framework 4.8.4250.0; Microsoft Windows 10.0.19042 )" + ], + "x-ms-client-request-id": "e480f13d-ab50-4acb-2859-9063e01f939b", + "x-ms-date": "Thu, 28 Jan 2021 00:29:48 GMT", + "x-ms-return-client-request-id": "true", + "x-ms-version": "2018-11-09" + }, + "RequestBody": null, + "StatusCode": 204, + "ResponseHeaders": { + "Content-Length": "0", + "Date": "Thu, 28 Jan 2021 00:29:47 GMT", + "Server": [ + "Windows-Azure-Queue/1.0", + "Microsoft-HTTPAPI/2.0" + ], + "x-ms-request-id": "e015b904-5003-0039-190c-f51457000000", + "x-ms-version": "2018-11-09" + }, + "ResponseBody": [] + } + ], + "Variables": { + "RandomSeed": "483653735", + "Storage_TestConfigDefault": "ProductionTenant\nkasoboltest\nU2FuaXRpemVk\nhttps://kasoboltest.blob.core.windows.net\nhttps://kasoboltest.file.core.windows.net\nhttps://kasoboltest.queue.core.windows.net\nhttps://kasoboltest.table.core.windows.net\n\n\n\n\nhttps://kasoboltest-secondary.blob.core.windows.net\nhttps://kasoboltest-secondary.file.core.windows.net\nhttps://kasoboltest-secondary.queue.core.windows.net\nhttps://kasoboltest-secondary.table.core.windows.net\n\nSanitized\n\n\nCloud\nBlobEndpoint=https://kasoboltest.blob.core.windows.net/;QueueEndpoint=https://kasoboltest.queue.core.windows.net/;FileEndpoint=https://kasoboltest.file.core.windows.net/;BlobSecondaryEndpoint=https://kasoboltest-secondary.blob.core.windows.net/;QueueSecondaryEndpoint=https://kasoboltest-secondary.queue.core.windows.net/;FileSecondaryEndpoint=https://kasoboltest-secondary.file.core.windows.net/;AccountName=kasoboltest;AccountKey=Kg==;\nencryptionScope" + } +} \ No newline at end of file diff --git a/sdk/storage/Azure.Storage.Queues/tests/SessionRecords/QueueClientTests/CanGetParentQueueServiceClientAsync.json b/sdk/storage/Azure.Storage.Queues/tests/SessionRecords/QueueClientTests/CanGetParentQueueServiceClientAsync.json new file mode 100644 index 0000000000000..5da71f9e90086 --- /dev/null +++ b/sdk/storage/Azure.Storage.Queues/tests/SessionRecords/QueueClientTests/CanGetParentQueueServiceClientAsync.json @@ -0,0 +1,101 @@ +{ + "Entries": [ + { + "RequestUri": "https://kasoboltest.queue.core.windows.net/test-queue-3539c10c-e096-7002-909f-9b531d6a5381", + "RequestMethod": "PUT", + "RequestHeaders": { + "Accept": "application/xml", + "Authorization": "Sanitized", + "traceparent": "00-778e982499897c4e94176dc1c89521f3-feb2733850c88443-00", + "User-Agent": [ + "azsdk-net-Storage.Queues/12.7.0-alpha.20210127.1", + "(.NET Framework 4.8.4250.0; Microsoft Windows 10.0.19042 )" + ], + "x-ms-client-request-id": "1d714c12-1753-2da7-089d-af143e90ffc5", + "x-ms-date": "Thu, 28 Jan 2021 00:29:48 GMT", + "x-ms-return-client-request-id": "true", + "x-ms-version": "2018-11-09" + }, + "RequestBody": null, + "StatusCode": 201, + "ResponseHeaders": { + "Content-Length": "0", + "Date": "Thu, 28 Jan 2021 00:29:47 GMT", + "Server": [ + "Windows-Azure-Queue/1.0", + "Microsoft-HTTPAPI/2.0" + ], + "x-ms-request-id": "7ef90633-d003-004e-090c-f59116000000", + "x-ms-version": "2018-11-09" + }, + "ResponseBody": [] + }, + { + "RequestUri": "https://kasoboltest.queue.core.windows.net/?restype=service\u0026comp=properties", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "application/xml", + "Authorization": "Sanitized", + "traceparent": "00-eda2f670e4fe4b469747df11ae84ab80-a5d7d9a09a74a44b-00", + "User-Agent": [ + "azsdk-net-Storage.Queues/12.7.0-alpha.20210127.1", + "(.NET Framework 4.8.4250.0; Microsoft Windows 10.0.19042 )" + ], + "x-ms-client-request-id": "d040ccd2-35f8-0f2e-29c0-6433027373f1", + "x-ms-date": "Thu, 28 Jan 2021 00:29:48 GMT", + "x-ms-return-client-request-id": "true", + "x-ms-version": "2018-11-09" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "Cache-Control": "no-cache", + "Content-Type": "application/xml", + "Date": "Thu, 28 Jan 2021 00:29:47 GMT", + "Server": [ + "Windows-Azure-Queue/1.0", + "Microsoft-HTTPAPI/2.0" + ], + "Transfer-Encoding": "chunked", + "Vary": "Origin", + "x-ms-request-id": "7ef90639-d003-004e-0d0c-f59116000000", + "x-ms-version": "2018-11-09" + }, + "ResponseBody": "\uFEFF\u003C?xml version=\u00221.0\u0022 encoding=\u0022utf-8\u0022?\u003E\u003CStorageServiceProperties\u003E\u003CLogging\u003E\u003CVersion\u003E1.0\u003C/Version\u003E\u003CRead\u003Etrue\u003C/Read\u003E\u003CWrite\u003Etrue\u003C/Write\u003E\u003CDelete\u003Efalse\u003C/Delete\u003E\u003CRetentionPolicy\u003E\u003CEnabled\u003Etrue\u003C/Enabled\u003E\u003CDays\u003E5\u003C/Days\u003E\u003C/RetentionPolicy\u003E\u003C/Logging\u003E\u003CHourMetrics\u003E\u003CVersion\u003E1.0\u003C/Version\u003E\u003CEnabled\u003Etrue\u003C/Enabled\u003E\u003CIncludeAPIs\u003Efalse\u003C/IncludeAPIs\u003E\u003CRetentionPolicy\u003E\u003CEnabled\u003Etrue\u003C/Enabled\u003E\u003CDays\u003E6\u003C/Days\u003E\u003C/RetentionPolicy\u003E\u003C/HourMetrics\u003E\u003CMinuteMetrics\u003E\u003CVersion\u003E1.0\u003C/Version\u003E\u003CEnabled\u003Etrue\u003C/Enabled\u003E\u003CIncludeAPIs\u003Efalse\u003C/IncludeAPIs\u003E\u003CRetentionPolicy\u003E\u003CEnabled\u003Etrue\u003C/Enabled\u003E\u003CDays\u003E6\u003C/Days\u003E\u003C/RetentionPolicy\u003E\u003C/MinuteMetrics\u003E\u003CCors\u003E\u003CCorsRule\u003E\u003CAllowedMethods\u003EGET,PUT\u003C/AllowedMethods\u003E\u003CAllowedOrigins\u003Ewww.ab.com,www.bc.com\u003C/AllowedOrigins\u003E\u003CAllowedHeaders\u003Ex-ms-meta-xyz,x-ms-meta-foo,x-ms-meta-data*,x-ms-meta-target*\u003C/AllowedHeaders\u003E\u003CExposedHeaders\u003Ex-ms-meta-abc,x-ms-meta-bcd,x-ms-meta-data*,x-ms-meta-source*\u003C/ExposedHeaders\u003E\u003CMaxAgeInSeconds\u003E500\u003C/MaxAgeInSeconds\u003E\u003C/CorsRule\u003E\u003C/Cors\u003E\u003C/StorageServiceProperties\u003E" + }, + { + "RequestUri": "https://kasoboltest.queue.core.windows.net/test-queue-3539c10c-e096-7002-909f-9b531d6a5381", + "RequestMethod": "DELETE", + "RequestHeaders": { + "Accept": "application/xml", + "Authorization": "Sanitized", + "traceparent": "00-489659a4e67ae7408aa9881f5443666a-94e1e0e195eb7d4c-00", + "User-Agent": [ + "azsdk-net-Storage.Queues/12.7.0-alpha.20210127.1", + "(.NET Framework 4.8.4250.0; Microsoft Windows 10.0.19042 )" + ], + "x-ms-client-request-id": "7141ee81-2e4f-2ecc-59a3-d289299458c5", + "x-ms-date": "Thu, 28 Jan 2021 00:29:48 GMT", + "x-ms-return-client-request-id": "true", + "x-ms-version": "2018-11-09" + }, + "RequestBody": null, + "StatusCode": 204, + "ResponseHeaders": { + "Content-Length": "0", + "Date": "Thu, 28 Jan 2021 00:29:47 GMT", + "Server": [ + "Windows-Azure-Queue/1.0", + "Microsoft-HTTPAPI/2.0" + ], + "x-ms-request-id": "7ef9063b-d003-004e-0f0c-f59116000000", + "x-ms-version": "2018-11-09" + }, + "ResponseBody": [] + } + ], + "Variables": { + "RandomSeed": "977852964", + "Storage_TestConfigDefault": "ProductionTenant\nkasoboltest\nU2FuaXRpemVk\nhttps://kasoboltest.blob.core.windows.net\nhttps://kasoboltest.file.core.windows.net\nhttps://kasoboltest.queue.core.windows.net\nhttps://kasoboltest.table.core.windows.net\n\n\n\n\nhttps://kasoboltest-secondary.blob.core.windows.net\nhttps://kasoboltest-secondary.file.core.windows.net\nhttps://kasoboltest-secondary.queue.core.windows.net\nhttps://kasoboltest-secondary.table.core.windows.net\n\nSanitized\n\n\nCloud\nBlobEndpoint=https://kasoboltest.blob.core.windows.net/;QueueEndpoint=https://kasoboltest.queue.core.windows.net/;FileEndpoint=https://kasoboltest.file.core.windows.net/;BlobSecondaryEndpoint=https://kasoboltest-secondary.blob.core.windows.net/;QueueSecondaryEndpoint=https://kasoboltest-secondary.queue.core.windows.net/;FileSecondaryEndpoint=https://kasoboltest-secondary.file.core.windows.net/;AccountName=kasoboltest;AccountKey=Kg==;\nencryptionScope" + } +} \ No newline at end of file diff --git a/sdk/storage/Azure.Storage.Queues/tests/SessionRecords/QueueClientTests/CanGetParentQueueServiceClient_WithAccountSAS.json b/sdk/storage/Azure.Storage.Queues/tests/SessionRecords/QueueClientTests/CanGetParentQueueServiceClient_WithAccountSAS.json new file mode 100644 index 0000000000000..f799391531ac5 --- /dev/null +++ b/sdk/storage/Azure.Storage.Queues/tests/SessionRecords/QueueClientTests/CanGetParentQueueServiceClient_WithAccountSAS.json @@ -0,0 +1,40 @@ +{ + "Entries": [ + { + "RequestUri": "https://kasoboltest.queue.core.windows.net/?sv=2020-04-08\u0026ss=q\u0026srt=sco\u0026st=2021-01-27T23:35:29Z\u0026se=2021-01-28T01:35:29Z\u0026sp=rwdlaup\u0026sig=Sanitized\u0026restype=service\u0026comp=properties", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "application/xml", + "traceparent": "00-13468fe1dfa3fc44a186692ca6c36089-1f95eaa98462a940-00", + "User-Agent": [ + "azsdk-net-Storage.Queues/12.7.0-alpha.20210127.1", + "(.NET Framework 4.8.4250.0; Microsoft Windows 10.0.19042 )" + ], + "x-ms-client-request-id": "cf63d1fe-2647-fe41-2aeb-c862912376dc", + "x-ms-return-client-request-id": "true", + "x-ms-version": "2018-11-09" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "Cache-Control": "no-cache", + "Content-Type": "application/xml", + "Date": "Thu, 28 Jan 2021 00:35:29 GMT", + "Server": [ + "Windows-Azure-Queue/1.0", + "Microsoft-HTTPAPI/2.0" + ], + "Transfer-Encoding": "chunked", + "Vary": "Origin", + "x-ms-request-id": "79ff1900-0003-0065-020d-f5e5ae000000", + "x-ms-version": "2018-11-09" + }, + "ResponseBody": "\uFEFF\u003C?xml version=\u00221.0\u0022 encoding=\u0022utf-8\u0022?\u003E\u003CStorageServiceProperties\u003E\u003CLogging\u003E\u003CVersion\u003E1.0\u003C/Version\u003E\u003CRead\u003Etrue\u003C/Read\u003E\u003CWrite\u003Etrue\u003C/Write\u003E\u003CDelete\u003Efalse\u003C/Delete\u003E\u003CRetentionPolicy\u003E\u003CEnabled\u003Etrue\u003C/Enabled\u003E\u003CDays\u003E5\u003C/Days\u003E\u003C/RetentionPolicy\u003E\u003C/Logging\u003E\u003CHourMetrics\u003E\u003CVersion\u003E1.0\u003C/Version\u003E\u003CEnabled\u003Etrue\u003C/Enabled\u003E\u003CIncludeAPIs\u003Efalse\u003C/IncludeAPIs\u003E\u003CRetentionPolicy\u003E\u003CEnabled\u003Etrue\u003C/Enabled\u003E\u003CDays\u003E6\u003C/Days\u003E\u003C/RetentionPolicy\u003E\u003C/HourMetrics\u003E\u003CMinuteMetrics\u003E\u003CVersion\u003E1.0\u003C/Version\u003E\u003CEnabled\u003Etrue\u003C/Enabled\u003E\u003CIncludeAPIs\u003Efalse\u003C/IncludeAPIs\u003E\u003CRetentionPolicy\u003E\u003CEnabled\u003Etrue\u003C/Enabled\u003E\u003CDays\u003E6\u003C/Days\u003E\u003C/RetentionPolicy\u003E\u003C/MinuteMetrics\u003E\u003CCors\u003E\u003CCorsRule\u003E\u003CAllowedMethods\u003EGET,PUT\u003C/AllowedMethods\u003E\u003CAllowedOrigins\u003Ewww.ab.com,www.bc.com\u003C/AllowedOrigins\u003E\u003CAllowedHeaders\u003Ex-ms-meta-xyz,x-ms-meta-foo,x-ms-meta-data*,x-ms-meta-target*\u003C/AllowedHeaders\u003E\u003CExposedHeaders\u003Ex-ms-meta-abc,x-ms-meta-bcd,x-ms-meta-data*,x-ms-meta-source*\u003C/ExposedHeaders\u003E\u003CMaxAgeInSeconds\u003E500\u003C/MaxAgeInSeconds\u003E\u003C/CorsRule\u003E\u003C/Cors\u003E\u003C/StorageServiceProperties\u003E" + } + ], + "Variables": { + "DateTimeOffsetNow": "2021-01-27T16:35:29.1939151-08:00", + "RandomSeed": "1697910175", + "Storage_TestConfigDefault": "ProductionTenant\nkasoboltest\nU2FuaXRpemVk\nhttps://kasoboltest.blob.core.windows.net\nhttps://kasoboltest.file.core.windows.net\nhttps://kasoboltest.queue.core.windows.net\nhttps://kasoboltest.table.core.windows.net\n\n\n\n\nhttps://kasoboltest-secondary.blob.core.windows.net\nhttps://kasoboltest-secondary.file.core.windows.net\nhttps://kasoboltest-secondary.queue.core.windows.net\nhttps://kasoboltest-secondary.table.core.windows.net\n\nSanitized\n\n\nCloud\nBlobEndpoint=https://kasoboltest.blob.core.windows.net/;QueueEndpoint=https://kasoboltest.queue.core.windows.net/;FileEndpoint=https://kasoboltest.file.core.windows.net/;BlobSecondaryEndpoint=https://kasoboltest-secondary.blob.core.windows.net/;QueueSecondaryEndpoint=https://kasoboltest-secondary.queue.core.windows.net/;FileSecondaryEndpoint=https://kasoboltest-secondary.file.core.windows.net/;AccountName=kasoboltest;AccountKey=Kg==;\nencryptionScope" + } +} \ No newline at end of file diff --git a/sdk/storage/Azure.Storage.Queues/tests/SessionRecords/QueueClientTests/CanGetParentQueueServiceClient_WithAccountSASAsync.json b/sdk/storage/Azure.Storage.Queues/tests/SessionRecords/QueueClientTests/CanGetParentQueueServiceClient_WithAccountSASAsync.json new file mode 100644 index 0000000000000..747658e7e18b3 --- /dev/null +++ b/sdk/storage/Azure.Storage.Queues/tests/SessionRecords/QueueClientTests/CanGetParentQueueServiceClient_WithAccountSASAsync.json @@ -0,0 +1,40 @@ +{ + "Entries": [ + { + "RequestUri": "https://kasoboltest.queue.core.windows.net/?sv=2020-04-08\u0026ss=q\u0026srt=sco\u0026st=2021-01-27T23:35:30Z\u0026se=2021-01-28T01:35:30Z\u0026sp=rwdlaup\u0026sig=Sanitized\u0026restype=service\u0026comp=properties", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "application/xml", + "traceparent": "00-9065ac06ad925b42bdd5396726a7652a-e1cc67d5df6c9841-00", + "User-Agent": [ + "azsdk-net-Storage.Queues/12.7.0-alpha.20210127.1", + "(.NET Framework 4.8.4250.0; Microsoft Windows 10.0.19042 )" + ], + "x-ms-client-request-id": "fb7d50dc-178c-1258-1f9b-50cd5a7fc5a4", + "x-ms-return-client-request-id": "true", + "x-ms-version": "2018-11-09" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "Cache-Control": "no-cache", + "Content-Type": "application/xml", + "Date": "Thu, 28 Jan 2021 00:35:29 GMT", + "Server": [ + "Windows-Azure-Queue/1.0", + "Microsoft-HTTPAPI/2.0" + ], + "Transfer-Encoding": "chunked", + "Vary": "Origin", + "x-ms-request-id": "3bb5797a-0003-0021-070d-f539c2000000", + "x-ms-version": "2018-11-09" + }, + "ResponseBody": "\uFEFF\u003C?xml version=\u00221.0\u0022 encoding=\u0022utf-8\u0022?\u003E\u003CStorageServiceProperties\u003E\u003CLogging\u003E\u003CVersion\u003E1.0\u003C/Version\u003E\u003CRead\u003Etrue\u003C/Read\u003E\u003CWrite\u003Etrue\u003C/Write\u003E\u003CDelete\u003Efalse\u003C/Delete\u003E\u003CRetentionPolicy\u003E\u003CEnabled\u003Etrue\u003C/Enabled\u003E\u003CDays\u003E5\u003C/Days\u003E\u003C/RetentionPolicy\u003E\u003C/Logging\u003E\u003CHourMetrics\u003E\u003CVersion\u003E1.0\u003C/Version\u003E\u003CEnabled\u003Etrue\u003C/Enabled\u003E\u003CIncludeAPIs\u003Efalse\u003C/IncludeAPIs\u003E\u003CRetentionPolicy\u003E\u003CEnabled\u003Etrue\u003C/Enabled\u003E\u003CDays\u003E6\u003C/Days\u003E\u003C/RetentionPolicy\u003E\u003C/HourMetrics\u003E\u003CMinuteMetrics\u003E\u003CVersion\u003E1.0\u003C/Version\u003E\u003CEnabled\u003Etrue\u003C/Enabled\u003E\u003CIncludeAPIs\u003Efalse\u003C/IncludeAPIs\u003E\u003CRetentionPolicy\u003E\u003CEnabled\u003Etrue\u003C/Enabled\u003E\u003CDays\u003E6\u003C/Days\u003E\u003C/RetentionPolicy\u003E\u003C/MinuteMetrics\u003E\u003CCors\u003E\u003CCorsRule\u003E\u003CAllowedMethods\u003EGET,PUT\u003C/AllowedMethods\u003E\u003CAllowedOrigins\u003Ewww.ab.com,www.bc.com\u003C/AllowedOrigins\u003E\u003CAllowedHeaders\u003Ex-ms-meta-xyz,x-ms-meta-foo,x-ms-meta-data*,x-ms-meta-target*\u003C/AllowedHeaders\u003E\u003CExposedHeaders\u003Ex-ms-meta-abc,x-ms-meta-bcd,x-ms-meta-data*,x-ms-meta-source*\u003C/ExposedHeaders\u003E\u003CMaxAgeInSeconds\u003E500\u003C/MaxAgeInSeconds\u003E\u003C/CorsRule\u003E\u003C/Cors\u003E\u003C/StorageServiceProperties\u003E" + } + ], + "Variables": { + "DateTimeOffsetNow": "2021-01-27T16:35:30.1306680-08:00", + "RandomSeed": "770541156", + "Storage_TestConfigDefault": "ProductionTenant\nkasoboltest\nU2FuaXRpemVk\nhttps://kasoboltest.blob.core.windows.net\nhttps://kasoboltest.file.core.windows.net\nhttps://kasoboltest.queue.core.windows.net\nhttps://kasoboltest.table.core.windows.net\n\n\n\n\nhttps://kasoboltest-secondary.blob.core.windows.net\nhttps://kasoboltest-secondary.file.core.windows.net\nhttps://kasoboltest-secondary.queue.core.windows.net\nhttps://kasoboltest-secondary.table.core.windows.net\n\nSanitized\n\n\nCloud\nBlobEndpoint=https://kasoboltest.blob.core.windows.net/;QueueEndpoint=https://kasoboltest.queue.core.windows.net/;FileEndpoint=https://kasoboltest.file.core.windows.net/;BlobSecondaryEndpoint=https://kasoboltest-secondary.blob.core.windows.net/;QueueSecondaryEndpoint=https://kasoboltest-secondary.queue.core.windows.net/;FileSecondaryEndpoint=https://kasoboltest-secondary.file.core.windows.net/;AccountName=kasoboltest;AccountKey=Kg==;\nencryptionScope" + } +} \ No newline at end of file diff --git a/sdk/storage/Azure.Storage.Queues/tests/SessionRecords/QueueClientTests/CanMockQueueServiceClientRetrieval.json b/sdk/storage/Azure.Storage.Queues/tests/SessionRecords/QueueClientTests/CanMockQueueServiceClientRetrieval.json new file mode 100644 index 0000000000000..20e5015d169f8 --- /dev/null +++ b/sdk/storage/Azure.Storage.Queues/tests/SessionRecords/QueueClientTests/CanMockQueueServiceClientRetrieval.json @@ -0,0 +1,4 @@ +{ + "Entries": [], + "Variables": {} +} \ No newline at end of file diff --git a/sdk/storage/Azure.Storage.Queues/tests/SessionRecords/QueueClientTests/CanMockQueueServiceClientRetrievalAsync.json b/sdk/storage/Azure.Storage.Queues/tests/SessionRecords/QueueClientTests/CanMockQueueServiceClientRetrievalAsync.json new file mode 100644 index 0000000000000..20e5015d169f8 --- /dev/null +++ b/sdk/storage/Azure.Storage.Queues/tests/SessionRecords/QueueClientTests/CanMockQueueServiceClientRetrievalAsync.json @@ -0,0 +1,4 @@ +{ + "Entries": [], + "Variables": {} +} \ No newline at end of file From 40e56ec3874feb532fce823bc94705bfd2f7fe60 Mon Sep 17 00:00:00 2001 From: Kamil Sobol Date: Fri, 29 Jan 2021 11:49:13 -0800 Subject: [PATCH 22/27] use project ref. --- .../Azure.Storage.Common/src/Azure.Storage.Common.csproj | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/sdk/storage/Azure.Storage.Common/src/Azure.Storage.Common.csproj b/sdk/storage/Azure.Storage.Common/src/Azure.Storage.Common.csproj index 89dae5ffc379f..0aec9e952e9ad 100644 --- a/sdk/storage/Azure.Storage.Common/src/Azure.Storage.Common.csproj +++ b/sdk/storage/Azure.Storage.Common/src/Azure.Storage.Common.csproj @@ -17,9 +17,12 @@ Azure.Storage + + + true + - - + From 30aad8870ec624e8e38ceed241e6a3457086271e Mon Sep 17 00:00:00 2001 From: Kamil Sobol Date: Fri, 29 Jan 2021 12:02:33 -0800 Subject: [PATCH 23/27] readme tweaks. --- sdk/storage/Azure.Storage.Queues/README.md | 47 +------------------ .../src/QueueClientOptions.cs | 35 +++++++++++++- 2 files changed, 36 insertions(+), 46 deletions(-) diff --git a/sdk/storage/Azure.Storage.Queues/README.md b/sdk/storage/Azure.Storage.Queues/README.md index 7f0ba9702fcd0..badd79a3da942 100644 --- a/sdk/storage/Azure.Storage.Queues/README.md +++ b/sdk/storage/Azure.Storage.Queues/README.md @@ -127,10 +127,8 @@ Learn more about enabling Azure Active Directory for authentication with Azure S ### Message encoding -This version of library does not encode message by default. V11 and prior versions base64-encoded messages by default. -This section shows how message encoding can be customized as well as additional error handling can be provided for poison messages. - -#### Configuration +This version of library does not encode message by default. V11 and prior versions as well as Azure Functions use base64-encoded messages by default. +Therefore it's recommended to use this feature for interop scenarios. ```C# Snippet:Azure_Storage_Queues_Samples_Sample03_MessageEncoding_ConfigureMessageEncodingAsync QueueClientOptions queueClientOptions = new QueueClientOptions() @@ -141,47 +139,6 @@ QueueClientOptions queueClientOptions = new QueueClientOptions() QueueClient queueClient = new QueueClient(connectionString, queueName, queueClientOptions); ``` -#### Poison messages - -We provide ability to define handler for situations where queue might contain messages that don't align with encoding setting configured in `QueueClientOptions`. -The handler gives access to message and its raw body. We don't delete message from queue, therefore handler logic should do that if desired. - -The handler is potentially invoked by both synchronous and asynchronous receive and peek APIs. Therefore implementation of the handler should align with `QueueClient` APIs that are being used. -See [more](https://github.com/Azure/azure-sdk-for-net/blob/master/sdk/core/Azure.Core/samples/Events.md) about how to implement handler correctly. - -The example below shows a handler with all possible cases explored. - -```C# Snippet:Azure_Storage_Queues_Samples_Sample03_MessageEncoding_InvalidMessageHandlerAsync -QueueClientOptions queueClientOptions = new QueueClientOptions() -{ - MessageEncoding = QueueMessageEncoding.Base64 -}; - -queueClientOptions.OnInvalidMessage += async (InvalidMessageEventArgs args) => -{ - if (args.Message is PeekedMessage peekedMessage) - { - Console.WriteLine($"Invalid message has been peeked, message id={peekedMessage.MessageId} body={peekedMessage.Body}"); - } - else if (args.Message is QueueMessage queueMessage) - { - Console.WriteLine($"Invalid message has been received, message id={queueMessage.MessageId} body={queueMessage.Body}"); - - if (args.RunSynchronously) - { - args.Queue.DeleteMessage(queueMessage.MessageId, queueMessage.PopReceipt); - } - else - { - await args.Queue.DeleteMessageAsync(queueMessage.MessageId, queueMessage.PopReceipt); - } - } -}; - -QueueClient queueClient = new QueueClient(connectionString, queueName, queueClientOptions); -``` - - ## Troubleshooting All Azure Storage Queue service operations will throw a diff --git a/sdk/storage/Azure.Storage.Queues/src/QueueClientOptions.cs b/sdk/storage/Azure.Storage.Queues/src/QueueClientOptions.cs index 5430d5d644773..b32c8876be67d 100644 --- a/sdk/storage/Azure.Storage.Queues/src/QueueClientOptions.cs +++ b/sdk/storage/Azure.Storage.Queues/src/QueueClientOptions.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. +// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. using System; @@ -125,6 +125,39 @@ public QueueClientOptions(ServiceVersion version = LatestVersion) /// /// The won't attempt to remove invalid message from the queue. Therefore such handling should be included into /// the event handler itself. + /// + /// The handler is potentially invoked by both synchronous and asynchronous receive and peek APIs. Therefore implementation of the handler should align with `QueueClient` APIs that are being used. + /// about how to implement handler correctly. The example below shows a handler with all possible cases explored. + /// + /// QueueClientOptions queueClientOptions = new QueueClientOptions() + /// { + /// MessageEncoding = QueueMessageEncoding.Base64 + /// }; + /// + /// queueClientOptions.OnInvalidMessage += async (InvalidMessageEventArgs args) => + /// { + /// if (args.Message is PeekedMessage peekedMessage) + /// { + /// Console.WriteLine($"Invalid message has been peeked, message id={peekedMessage.MessageId} body={peekedMessage.Body}"); + /// } + /// else if (args.Message is QueueMessage queueMessage) + /// { + /// Console.WriteLine($"Invalid message has been received, message id={queueMessage.MessageId} body={queueMessage.Body}"); + /// + /// if (args.RunSynchronously) + /// { + /// args.QueueClient.DeleteMessage(queueMessage.MessageId, queueMessage.PopReceipt); + /// } + /// else + /// { + /// await args.QueueClient.DeleteMessageAsync(queueMessage.MessageId, queueMessage.PopReceipt); + /// } + /// } + /// }; + /// + /// QueueClient queueClient = new QueueClient(connectionString, queueName, queueClientOptions); + /// + /// /// public event SyncAsyncEventHandler OnInvalidMessage; From 13d53d52a1eb3440086601d27e5f43320d72ce43 Mon Sep 17 00:00:00 2001 From: Kamil Sobol Date: Fri, 29 Jan 2021 12:29:50 -0800 Subject: [PATCH 24/27] renaming. --- .../Azure.Storage.Queues.netstandard2.0.cs | 17 ++++----- .../samples/Sample03_MessageEncoding.cs | 18 +++++----- .../Azure.Storage.Queues/src/QueueClient.cs | 20 +++++------ .../src/QueueClientConfiguration.cs | 6 ++-- .../src/QueueClientOptions.cs | 36 ++++++++++--------- ...=> QueueMessageDecodingFailedEventArgs.cs} | 36 +++++++++++-------- .../src/QueueServiceClient.cs | 4 +-- .../tests/QueueClientTests.cs | 24 ++++++------- .../tests/QueueTestBase.cs | 6 ++-- 9 files changed, 88 insertions(+), 79 deletions(-) rename sdk/storage/Azure.Storage.Queues/src/{InvalidMessageEventArgs.cs => QueueMessageDecodingFailedEventArgs.cs} (75%) diff --git a/sdk/storage/Azure.Storage.Queues/api/Azure.Storage.Queues.netstandard2.0.cs b/sdk/storage/Azure.Storage.Queues/api/Azure.Storage.Queues.netstandard2.0.cs index 7a81916b8c4cc..264703dd93244 100644 --- a/sdk/storage/Azure.Storage.Queues/api/Azure.Storage.Queues.netstandard2.0.cs +++ b/sdk/storage/Azure.Storage.Queues/api/Azure.Storage.Queues.netstandard2.0.cs @@ -1,12 +1,5 @@ namespace Azure.Storage.Queues { - public partial class InvalidMessageEventArgs : Azure.SyncAsyncEventArgs - { - public InvalidMessageEventArgs(Azure.Storage.Queues.QueueClient queueClient, Azure.Storage.Queues.Models.PeekedMessage message, bool runSynchronously, System.Threading.CancellationToken cancellationToken) : base (default(bool), default(System.Threading.CancellationToken)) { } - public InvalidMessageEventArgs(Azure.Storage.Queues.QueueClient queueClient, Azure.Storage.Queues.Models.QueueMessage message, bool runSynchronously, System.Threading.CancellationToken cancellationToken) : base (default(bool), default(System.Threading.CancellationToken)) { } - public object Message { get { throw null; } } - public Azure.Storage.Queues.QueueClient QueueClient { get { throw null; } } - } public partial class QueueClient { protected QueueClient() { } @@ -80,7 +73,7 @@ public QueueClientOptions(Azure.Storage.Queues.QueueClientOptions.ServiceVersion public System.Uri GeoRedundantSecondaryUri { get { throw null; } set { } } public Azure.Storage.Queues.QueueMessageEncoding MessageEncoding { get { throw null; } set { } } public Azure.Storage.Queues.QueueClientOptions.ServiceVersion Version { get { throw null; } } - public event Azure.Core.SyncAsyncEventHandler OnInvalidMessage { add { } remove { } } + public event Azure.Core.SyncAsyncEventHandler MessageDecodingFailed { add { } remove { } } public enum ServiceVersion { V2019_02_02 = 1, @@ -90,6 +83,14 @@ public enum ServiceVersion V2020_04_08 = 5, } } + public partial class QueueMessageDecodingFailedEventArgs : Azure.SyncAsyncEventArgs + { + public QueueMessageDecodingFailedEventArgs(Azure.Storage.Queues.QueueClient queueClient, Azure.Storage.Queues.Models.PeekedMessage message, bool runSynchronously, System.Threading.CancellationToken cancellationToken) : base (default(bool), default(System.Threading.CancellationToken)) { } + public QueueMessageDecodingFailedEventArgs(Azure.Storage.Queues.QueueClient queueClient, Azure.Storage.Queues.Models.QueueMessage message, bool runSynchronously, System.Threading.CancellationToken cancellationToken) : base (default(bool), default(System.Threading.CancellationToken)) { } + public Azure.Storage.Queues.Models.PeekedMessage PeekedMessage { get { throw null; } } + public Azure.Storage.Queues.QueueClient Queue { get { throw null; } } + public Azure.Storage.Queues.Models.QueueMessage ReceivedMessage { get { throw null; } } + } public enum QueueMessageEncoding { None = 0, diff --git a/sdk/storage/Azure.Storage.Queues/samples/Sample03_MessageEncoding.cs b/sdk/storage/Azure.Storage.Queues/samples/Sample03_MessageEncoding.cs index a271e0238f3c8..98140a6164b3d 100644 --- a/sdk/storage/Azure.Storage.Queues/samples/Sample03_MessageEncoding.cs +++ b/sdk/storage/Azure.Storage.Queues/samples/Sample03_MessageEncoding.cs @@ -26,34 +26,34 @@ public void ConfigureMessageEncodingAsync() } [Test] - public void InvalidMessageHandlerAsync() + public void MessageDecodingFailedHandlerAsync() { var connectionString = ConnectionString; var queueName = "foo"; - #region Snippet:Azure_Storage_Queues_Samples_Sample03_MessageEncoding_InvalidMessageHandlerAsync + #region Snippet:Azure_Storage_Queues_Samples_Sample03_MessageEncoding_MessageDecodingFailedHandlerAsync QueueClientOptions queueClientOptions = new QueueClientOptions() { MessageEncoding = QueueMessageEncoding.Base64 }; - queueClientOptions.OnInvalidMessage += async (InvalidMessageEventArgs args) => + queueClientOptions.MessageDecodingFailed += async (QueueMessageDecodingFailedEventArgs args) => { - if (args.Message is PeekedMessage peekedMessage) + if (args.PeekedMessage != null) { - Console.WriteLine($"Invalid message has been peeked, message id={peekedMessage.MessageId} body={peekedMessage.Body}"); + Console.WriteLine($"Invalid message has been peeked, message id={args.PeekedMessage.MessageId} body={args.PeekedMessage.Body}"); } - else if (args.Message is QueueMessage queueMessage) + else if (args.ReceivedMessage != null) { - Console.WriteLine($"Invalid message has been received, message id={queueMessage.MessageId} body={queueMessage.Body}"); + Console.WriteLine($"Invalid message has been received, message id={args.ReceivedMessage.MessageId} body={args.ReceivedMessage.Body}"); if (args.RunSynchronously) { - args.QueueClient.DeleteMessage(queueMessage.MessageId, queueMessage.PopReceipt); + args.Queue.DeleteMessage(args.ReceivedMessage.MessageId, args.ReceivedMessage.PopReceipt); } else { - await args.QueueClient.DeleteMessageAsync(queueMessage.MessageId, queueMessage.PopReceipt); + await args.Queue.DeleteMessageAsync(args.ReceivedMessage.MessageId, args.ReceivedMessage.PopReceipt); } } }; diff --git a/sdk/storage/Azure.Storage.Queues/src/QueueClient.cs b/sdk/storage/Azure.Storage.Queues/src/QueueClient.cs index f4b6560b8e5e0..76e82452ca096 100644 --- a/sdk/storage/Azure.Storage.Queues/src/QueueClient.cs +++ b/sdk/storage/Azure.Storage.Queues/src/QueueClient.cs @@ -207,7 +207,7 @@ public QueueClient(string connectionString, string queueName, QueueClientOptions version: options.Version, clientSideEncryption: QueueClientSideEncryptionOptions.CloneFrom(options._clientSideEncryptionOptions), messageEncoding: options.MessageEncoding, - invalidMessageHandler: options.GetInvalidMessageHandlers()); + queueMessageDecodingFailedHandlers: options.GetMessageDecodingFailedHandlers()); (QueueRestClient queueRestClient, MessagesRestClient messagesRestClient, MessageIdRestClient messageIdRestClient) = BuildRestClients(); _queueRestClient = queueRestClient; @@ -344,7 +344,7 @@ internal QueueClient( version: options.Version, clientSideEncryption: QueueClientSideEncryptionOptions.CloneFrom(options._clientSideEncryptionOptions), messageEncoding: options.MessageEncoding, - invalidMessageHandler: options.GetInvalidMessageHandlers()); + queueMessageDecodingFailedHandlers: options.GetMessageDecodingFailedHandlers()); (QueueRestClient queueRestClient, MessagesRestClient messagesRestClient, MessageIdRestClient messageIdRestClient) = BuildRestClients(); _queueRestClient = queueRestClient; @@ -2245,17 +2245,17 @@ private async Task ToQueueMessagesWithInvalidMessageHandling( { queueMessages.Add(QueueMessage.ToQueueMessage(dequeuedMessageItem, ClientConfiguration.MessageEncoding)); } - catch (FormatException) when (ClientConfiguration.InvalidMessageHandler != null) + catch (FormatException) when (ClientConfiguration.QueueMessageDecodingFailedHandlers != null) { #pragma warning disable AZC0110 // DO NOT use await keyword in possibly synchronous scope. - await ClientConfiguration.InvalidMessageHandler.RaiseAsync( - new InvalidMessageEventArgs( + await ClientConfiguration.QueueMessageDecodingFailedHandlers.RaiseAsync( + new QueueMessageDecodingFailedEventArgs( queueClient: this, message: QueueMessage.ToQueueMessage(dequeuedMessageItem, QueueMessageEncoding.None), runSynchronously: !async, cancellationToken: cancellationToken), nameof(QueueClientOptions), - nameof(QueueClientOptions.OnInvalidMessage), + nameof(QueueClientOptions.MessageDecodingFailed), ClientConfiguration.ClientDiagnostics).ConfigureAwait(false); #pragma warning restore AZC0110 // DO NOT use await keyword in possibly synchronous scope. } @@ -2597,17 +2597,17 @@ private async Task ToPeekedMessagesWithInvalidMessageHandling( { peekedMessages.Add(PeekedMessage.ToPeekedMessage(peekedMessageItem, ClientConfiguration.MessageEncoding)); } - catch (FormatException) when (ClientConfiguration.InvalidMessageHandler != null) + catch (FormatException) when (ClientConfiguration.QueueMessageDecodingFailedHandlers != null) { #pragma warning disable AZC0110 // DO NOT use await keyword in possibly synchronous scope. - await ClientConfiguration.InvalidMessageHandler.RaiseAsync( - new InvalidMessageEventArgs( + await ClientConfiguration.QueueMessageDecodingFailedHandlers.RaiseAsync( + new QueueMessageDecodingFailedEventArgs( queueClient: this, message: PeekedMessage.ToPeekedMessage(peekedMessageItem, QueueMessageEncoding.None), runSynchronously: !async, cancellationToken: cancellationToken), nameof(QueueClientOptions), - nameof(QueueClientOptions.OnInvalidMessage), + nameof(QueueClientOptions.MessageDecodingFailed), ClientConfiguration.ClientDiagnostics).ConfigureAwait(false); #pragma warning restore AZC0110 // DO NOT use await keyword in possibly synchronous scope. } diff --git a/sdk/storage/Azure.Storage.Queues/src/QueueClientConfiguration.cs b/sdk/storage/Azure.Storage.Queues/src/QueueClientConfiguration.cs index 2491a6f2443e7..cacb5e99d12e8 100644 --- a/sdk/storage/Azure.Storage.Queues/src/QueueClientConfiguration.cs +++ b/sdk/storage/Azure.Storage.Queues/src/QueueClientConfiguration.cs @@ -16,7 +16,7 @@ internal class QueueClientConfiguration : StorageClientConfiguration public QueueMessageEncoding MessageEncoding { get; internal set; } - public SyncAsyncEventHandler InvalidMessageHandler { get; internal set; } + public SyncAsyncEventHandler QueueMessageDecodingFailedHandlers { get; internal set; } public QueueClientConfiguration( HttpPipeline pipeline, @@ -25,13 +25,13 @@ public QueueClientConfiguration( QueueClientOptions.ServiceVersion version, QueueClientSideEncryptionOptions clientSideEncryption, QueueMessageEncoding messageEncoding, - SyncAsyncEventHandler invalidMessageHandler) + SyncAsyncEventHandler queueMessageDecodingFailedHandlers) : base(pipeline, sharedKeyCredential, clientDiagnostics) { Version = version; ClientSideEncryption = clientSideEncryption; MessageEncoding = messageEncoding; - InvalidMessageHandler = invalidMessageHandler; + QueueMessageDecodingFailedHandlers = queueMessageDecodingFailedHandlers; } } } diff --git a/sdk/storage/Azure.Storage.Queues/src/QueueClientOptions.cs b/sdk/storage/Azure.Storage.Queues/src/QueueClientOptions.cs index b32c8876be67d..c001e295d9ede 100644 --- a/sdk/storage/Azure.Storage.Queues/src/QueueClientOptions.cs +++ b/sdk/storage/Azure.Storage.Queues/src/QueueClientOptions.cs @@ -114,43 +114,45 @@ public QueueClientOptions(ServiceVersion version = LatestVersion) public QueueMessageEncoding MessageEncoding { get; set; } = QueueMessageEncoding.None; /// - /// Optional. Performs the tasks needed when an invalid message is received or peaked from the queue. + /// Optional. Performs the tasks needed when a message is received or peaked from the queue but cannot be decoded. /// - /// Invalid message can be received or peaked when is expecting certain + /// Such message can be received or peaked when is expecting certain /// but there's another producer that is not encoding messages in expected way. I.e. the queue contains messages with different encoding. /// - /// contains that has received invalid message as well as the message - /// which can be either or with raw body, i.e. no decoding will be attempted so that + /// contains that has received the message as well as + /// or + /// with raw body, i.e. no decoding will be attempted so that /// body can be inspected as has been received from the queue. /// - /// The won't attempt to remove invalid message from the queue. Therefore such handling should be included into + /// The won't attempt to remove the message from the queue. Therefore such handling should be included into /// the event handler itself. /// - /// The handler is potentially invoked by both synchronous and asynchronous receive and peek APIs. Therefore implementation of the handler should align with `QueueClient` APIs that are being used. - /// about how to implement handler correctly. The example below shows a handler with all possible cases explored. - /// + /// The handler is potentially invoked by both synchronous and asynchronous receive and peek APIs. Therefore implementation of the handler should align with + /// APIs that are being used. + /// See about how to implement handler correctly. The example below shows a handler with all possible cases explored. + /// /// QueueClientOptions queueClientOptions = new QueueClientOptions() /// { /// MessageEncoding = QueueMessageEncoding.Base64 /// }; /// - /// queueClientOptions.OnInvalidMessage += async (InvalidMessageEventArgs args) => + /// queueClientOptions.MessageDecodingFailed += async (QueueMessageDecodingFailedEventArgs args) => /// { - /// if (args.Message is PeekedMessage peekedMessage) + /// if (args.PeekedMessage != null) /// { - /// Console.WriteLine($"Invalid message has been peeked, message id={peekedMessage.MessageId} body={peekedMessage.Body}"); + /// Console.WriteLine($"Invalid message has been peeked, message id={args.PeekedMessage.MessageId} body={args.PeekedMessage.Body}"); /// } - /// else if (args.Message is QueueMessage queueMessage) + /// else if (args.ReceivedMessage != null) /// { - /// Console.WriteLine($"Invalid message has been received, message id={queueMessage.MessageId} body={queueMessage.Body}"); + /// Console.WriteLine($"Invalid message has been received, message id={args.ReceivedMessage.MessageId} body={args.ReceivedMessage.Body}"); /// /// if (args.RunSynchronously) /// { - /// args.QueueClient.DeleteMessage(queueMessage.MessageId, queueMessage.PopReceipt); + /// args.Queue.DeleteMessage(args.ReceivedMessage.MessageId, args.ReceivedMessage.PopReceipt); /// } /// else /// { - /// await args.QueueClient.DeleteMessageAsync(queueMessage.MessageId, queueMessage.PopReceipt); + /// await args.Queue.DeleteMessageAsync(args.ReceivedMessage.MessageId, args.ReceivedMessage.PopReceipt); /// } /// } /// }; @@ -159,9 +161,9 @@ public QueueClientOptions(ServiceVersion version = LatestVersion) /// /// /// - public event SyncAsyncEventHandler OnInvalidMessage; + public event SyncAsyncEventHandler MessageDecodingFailed; - internal SyncAsyncEventHandler GetInvalidMessageHandlers() => OnInvalidMessage; + internal SyncAsyncEventHandler GetMessageDecodingFailedHandlers() => MessageDecodingFailed; #region Advanced Options internal ClientSideEncryptionOptions _clientSideEncryptionOptions; diff --git a/sdk/storage/Azure.Storage.Queues/src/InvalidMessageEventArgs.cs b/sdk/storage/Azure.Storage.Queues/src/QueueMessageDecodingFailedEventArgs.cs similarity index 75% rename from sdk/storage/Azure.Storage.Queues/src/InvalidMessageEventArgs.cs rename to sdk/storage/Azure.Storage.Queues/src/QueueMessageDecodingFailedEventArgs.cs index d5874bbeafda7..82164ef3d2894 100644 --- a/sdk/storage/Azure.Storage.Queues/src/InvalidMessageEventArgs.cs +++ b/sdk/storage/Azure.Storage.Queues/src/QueueMessageDecodingFailedEventArgs.cs @@ -8,24 +8,30 @@ namespace Azure.Storage.Queues { /// - /// Contains information about invalid message. - /// See also . + /// Contains information about message that could not be decoded. + /// See also . /// - public class InvalidMessageEventArgs : SyncAsyncEventArgs + public class QueueMessageDecodingFailedEventArgs : SyncAsyncEventArgs { /// - /// Gets the that has received invalid message. + /// Gets the that has received message. /// - public QueueClient QueueClient { get; } + public QueueClient Queue { get; } /// - /// Gets the invalid message which can be either or . + /// Gets the that has been received and could not be decoded. /// The body of the message is as received, i.e. no decoding is attempted. /// - public object Message { get; } + public QueueMessage ReceivedMessage { get; } /// - /// Initializes a new instance of the . + /// Gets the that has been peeked and could not be decoded. + /// The body of the message is as received, i.e. no decoding is attempted. + /// + public PeekedMessage PeekedMessage { get; } + + /// + /// Initializes a new instance of the . /// /// The that has received invalid message. /// The invalid message. @@ -45,7 +51,7 @@ public class InvalidMessageEventArgs : SyncAsyncEventArgs /// Thrown if or /// are null. /// - public InvalidMessageEventArgs( + public QueueMessageDecodingFailedEventArgs( QueueClient queueClient, QueueMessage message, bool runSynchronously, @@ -54,12 +60,12 @@ public InvalidMessageEventArgs( { Argument.AssertNotNull(queueClient, nameof(queueClient)); Argument.AssertNotNull(message, nameof(message)); - QueueClient = queueClient; - Message = message; + Queue = queueClient; + ReceivedMessage = message; } /// - /// Initializes a new instance of the . + /// Initializes a new instance of the . /// /// The that has received invalid message. /// The invalid message. @@ -79,7 +85,7 @@ public InvalidMessageEventArgs( /// Thrown if or /// are null. /// - public InvalidMessageEventArgs( + public QueueMessageDecodingFailedEventArgs( QueueClient queueClient, PeekedMessage message, bool runSynchronously, @@ -88,8 +94,8 @@ public InvalidMessageEventArgs( { Argument.AssertNotNull(queueClient, nameof(queueClient)); Argument.AssertNotNull(message, nameof(message)); - QueueClient = queueClient; - Message = message; + Queue = queueClient; + PeekedMessage = message; } } } diff --git a/sdk/storage/Azure.Storage.Queues/src/QueueServiceClient.cs b/sdk/storage/Azure.Storage.Queues/src/QueueServiceClient.cs index 36d8f35b496cf..a1cc6db5d8abe 100644 --- a/sdk/storage/Azure.Storage.Queues/src/QueueServiceClient.cs +++ b/sdk/storage/Azure.Storage.Queues/src/QueueServiceClient.cs @@ -132,7 +132,7 @@ public QueueServiceClient(string connectionString, QueueClientOptions options) version: options.Version, clientSideEncryption: QueueClientSideEncryptionOptions.CloneFrom(options._clientSideEncryptionOptions), messageEncoding: options.MessageEncoding, - invalidMessageHandler: options.GetInvalidMessageHandlers()); + queueMessageDecodingFailedHandlers: options.GetMessageDecodingFailedHandlers()); _serviceRestClient = BuildServiceRestClient(); } @@ -259,7 +259,7 @@ internal QueueServiceClient( version: options.Version, clientSideEncryption: QueueClientSideEncryptionOptions.CloneFrom(options._clientSideEncryptionOptions), messageEncoding: options.MessageEncoding, - invalidMessageHandler: options.GetInvalidMessageHandlers()); + queueMessageDecodingFailedHandlers: options.GetMessageDecodingFailedHandlers()); _serviceRestClient = BuildServiceRestClient(); } diff --git a/sdk/storage/Azure.Storage.Queues/tests/QueueClientTests.cs b/sdk/storage/Azure.Storage.Queues/tests/QueueClientTests.cs index d4dd0819ca2d6..44c19a8971d75 100644 --- a/sdk/storage/Azure.Storage.Queues/tests/QueueClientTests.cs +++ b/sdk/storage/Azure.Storage.Queues/tests/QueueClientTests.cs @@ -814,19 +814,19 @@ public async Task CanHandleInvalidPeekedMessageAndReturnValid() { // Arrange await using DisposingQueue test = await GetTestQueueAsync(); - object badMessage = null; - object badMessage2 = null; + PeekedMessage badMessage = null; + PeekedMessage badMessage2 = null; var encodingClient = GetEncodingClient( test.Queue.Name, QueueMessageEncoding.Base64, arg => { - badMessage = arg.Message; + badMessage = arg.PeekedMessage; return Task.CompletedTask; }, arg => { - badMessage2 = arg.Message; + badMessage2 = arg.PeekedMessage; return Task.CompletedTask; }); var nonEncodedContent = "test_content"; @@ -840,9 +840,9 @@ public async Task CanHandleInvalidPeekedMessageAndReturnValid() // Assert Assert.AreEqual(1, peekedMessages.Count()); Assert.NotNull(badMessage); - Assert.AreEqual(nonEncodedContent, ((PeekedMessage)badMessage).Body.ToString()); + Assert.AreEqual(nonEncodedContent, badMessage.Body.ToString()); Assert.NotNull(badMessage2); - Assert.AreEqual(nonEncodedContent, ((PeekedMessage)badMessage2).Body.ToString()); + Assert.AreEqual(nonEncodedContent, badMessage2.Body.ToString()); } [Test] @@ -922,19 +922,19 @@ public async Task CanHandleInvalidMessageAndReturnValid() { // Arrange await using DisposingQueue test = await GetTestQueueAsync(); - object badMessage = null; - object badMessage2 = null; + QueueMessage badMessage = null; + QueueMessage badMessage2 = null; var encodingClient = GetEncodingClient( test.Queue.Name, QueueMessageEncoding.Base64, arg => { - badMessage = arg.Message; + badMessage = arg.ReceivedMessage; return Task.CompletedTask; }, arg => { - badMessage2 = arg.Message; + badMessage2 = arg.ReceivedMessage; return Task.CompletedTask; }); var nonEncodedContent = "test_content"; @@ -948,9 +948,9 @@ public async Task CanHandleInvalidMessageAndReturnValid() // Assert Assert.AreEqual(1, queueMessages.Count()); Assert.NotNull(badMessage); - Assert.AreEqual(nonEncodedContent, ((QueueMessage)badMessage).Body.ToString()); + Assert.AreEqual(nonEncodedContent, badMessage.Body.ToString()); Assert.NotNull(badMessage2); - Assert.AreEqual(nonEncodedContent, ((QueueMessage)badMessage2).Body.ToString()); + Assert.AreEqual(nonEncodedContent, badMessage2.Body.ToString()); } [Test] diff --git a/sdk/storage/Azure.Storage.Queues/tests/QueueTestBase.cs b/sdk/storage/Azure.Storage.Queues/tests/QueueTestBase.cs index aad35bee0baf7..2b2259edd3e00 100644 --- a/sdk/storage/Azure.Storage.Queues/tests/QueueTestBase.cs +++ b/sdk/storage/Azure.Storage.Queues/tests/QueueTestBase.cs @@ -156,13 +156,13 @@ public async Task GetTestQueueAsync( public QueueClient GetEncodingClient( string queueName, QueueMessageEncoding encoding, - params SyncAsyncEventHandler[] invalidMessageHandlers) + params SyncAsyncEventHandler[] messageDecodingFailedHandlers) { var options = GetOptions(); options.MessageEncoding = encoding; - foreach (var invalidMessageHandler in invalidMessageHandlers) + foreach (var messageDecodingFailedHandler in messageDecodingFailedHandlers) { - options.OnInvalidMessage += invalidMessageHandler; + options.MessageDecodingFailed += messageDecodingFailedHandler; } var service = GetServiceClient_SharedKey_UnInstrumented(options); var queueClient = service.GetQueueClient(queueName); From 6585e9fe381c66ffe425f58e5aa8e5bd4aa6902c Mon Sep 17 00:00:00 2001 From: Kamil Sobol Date: Fri, 29 Jan 2021 12:37:00 -0800 Subject: [PATCH 25/27] misc. --- .../Azure.Storage.Queues/src/QueueClient.cs | 1 + .../tests/QueueClientTests.cs | 46 +++++ ...eDecodingFailedHandlersAtConstruction.json | 167 ++++++++++++++++++ ...dingFailedHandlersAtConstructionAsync.json | 167 ++++++++++++++++++ 4 files changed, 381 insertions(+) create mode 100644 sdk/storage/Azure.Storage.Queues/tests/SessionRecords/QueueClientTests/TakesSnapshotOfMessageDecodingFailedHandlersAtConstruction.json create mode 100644 sdk/storage/Azure.Storage.Queues/tests/SessionRecords/QueueClientTests/TakesSnapshotOfMessageDecodingFailedHandlersAtConstructionAsync.json diff --git a/sdk/storage/Azure.Storage.Queues/src/QueueClient.cs b/sdk/storage/Azure.Storage.Queues/src/QueueClient.cs index 76e82452ca096..7ab43c2d95155 100644 --- a/sdk/storage/Azure.Storage.Queues/src/QueueClient.cs +++ b/sdk/storage/Azure.Storage.Queues/src/QueueClient.cs @@ -3225,6 +3225,7 @@ public static QueueClient WithClientSideEncryptionOptions(this QueueClient clien /// A new instance. public static QueueServiceClient GetParentQueueServiceClient(this QueueClient client) { + Argument.AssertNotNull(client, nameof(client)); return client.GetParentQueueServiceClientCore(); } } diff --git a/sdk/storage/Azure.Storage.Queues/tests/QueueClientTests.cs b/sdk/storage/Azure.Storage.Queues/tests/QueueClientTests.cs index 44c19a8971d75..31c831d481caf 100644 --- a/sdk/storage/Azure.Storage.Queues/tests/QueueClientTests.cs +++ b/sdk/storage/Azure.Storage.Queues/tests/QueueClientTests.cs @@ -953,6 +953,52 @@ public async Task CanHandleInvalidMessageAndReturnValid() Assert.AreEqual(nonEncodedContent, badMessage2.Body.ToString()); } + [Test] + public async Task TakesSnapshotOfMessageDecodingFailedHandlersAtConstruction() + { + // Arrange + await using DisposingQueue test = await GetTestQueueAsync(); + QueueMessage badMessage = null; + QueueMessage badMessage2 = null; + QueueMessage badMessage3 = null; + var options = GetOptions(); + options.MessageEncoding = QueueMessageEncoding.Base64; + options.MessageDecodingFailed += arg => + { + badMessage = arg.ReceivedMessage; + return Task.CompletedTask; + }; + options.MessageDecodingFailed += arg => + { + badMessage2 = arg.ReceivedMessage; + return Task.CompletedTask; + }; + + var encodingClient = GetServiceClient_SharedKey(options).GetQueueClient(test.Queue.Name); + + // add third handler after client creation + options.MessageDecodingFailed += arg => + { + badMessage3 = arg.ReceivedMessage; + return Task.CompletedTask; + }; + var nonEncodedContent = "test_content"; + + await test.Queue.SendMessageAsync(nonEncodedContent); + await encodingClient.SendMessageAsync(nonEncodedContent); + + // Act + QueueMessage[] queueMessages = await encodingClient.ReceiveMessagesAsync(10); + + // Assert + Assert.AreEqual(1, queueMessages.Count()); + Assert.NotNull(badMessage); + Assert.AreEqual(nonEncodedContent, badMessage.Body.ToString()); + Assert.NotNull(badMessage2); + Assert.AreEqual(nonEncodedContent, badMessage2.Body.ToString()); + Assert.Null(badMessage3); + } + [Test] public async Task PropagatesExceptionIfInvalidQueueMessageAndHandlerThrows() { diff --git a/sdk/storage/Azure.Storage.Queues/tests/SessionRecords/QueueClientTests/TakesSnapshotOfMessageDecodingFailedHandlersAtConstruction.json b/sdk/storage/Azure.Storage.Queues/tests/SessionRecords/QueueClientTests/TakesSnapshotOfMessageDecodingFailedHandlersAtConstruction.json new file mode 100644 index 0000000000000..c0c3495092145 --- /dev/null +++ b/sdk/storage/Azure.Storage.Queues/tests/SessionRecords/QueueClientTests/TakesSnapshotOfMessageDecodingFailedHandlersAtConstruction.json @@ -0,0 +1,167 @@ +{ + "Entries": [ + { + "RequestUri": "https://kasoboltest.queue.core.windows.net/test-queue-2f54b828-ad62-0c6c-49f8-153580026307", + "RequestMethod": "PUT", + "RequestHeaders": { + "Accept": "application/xml", + "Authorization": "Sanitized", + "traceparent": "00-473979af0a673846ba0c000e92addff6-fe04230fdc6bf04e-00", + "User-Agent": [ + "azsdk-net-Storage.Queues/12.7.0-alpha.20210129.1", + "(.NET Framework 4.8.4250.0; Microsoft Windows 10.0.19042 )" + ], + "x-ms-client-request-id": "bcd7dfc7-a1c3-34dd-ddca-2ea9ad339ca5", + "x-ms-date": "Fri, 29 Jan 2021 20:36:39 GMT", + "x-ms-return-client-request-id": "true", + "x-ms-version": "2018-11-09" + }, + "RequestBody": null, + "StatusCode": 201, + "ResponseHeaders": { + "Content-Length": "0", + "Date": "Fri, 29 Jan 2021 20:36:39 GMT", + "Server": [ + "Windows-Azure-Queue/1.0", + "Microsoft-HTTPAPI/2.0" + ], + "x-ms-request-id": "049887f0-f003-003f-647e-f6e32f000000", + "x-ms-version": "2018-11-09" + }, + "ResponseBody": [] + }, + { + "RequestUri": "https://kasoboltest.queue.core.windows.net/test-queue-2f54b828-ad62-0c6c-49f8-153580026307/messages", + "RequestMethod": "POST", + "RequestHeaders": { + "Accept": "application/xml", + "Authorization": "Sanitized", + "Content-Length": "71", + "Content-Type": "application/xml", + "traceparent": "00-9dd34137f98c5b47baace5ff8197e3cd-a76a3012c5bb6d40-00", + "User-Agent": [ + "azsdk-net-Storage.Queues/12.7.0-alpha.20210129.1", + "(.NET Framework 4.8.4250.0; Microsoft Windows 10.0.19042 )" + ], + "x-ms-client-request-id": "a06edfa1-a72b-5744-37ff-43d035092a71", + "x-ms-date": "Fri, 29 Jan 2021 20:36:40 GMT", + "x-ms-return-client-request-id": "true", + "x-ms-version": "2018-11-09" + }, + "RequestBody": "\uFEFF\u003CQueueMessage\u003E\u003CMessageText\u003Etest_content\u003C/MessageText\u003E\u003C/QueueMessage\u003E", + "StatusCode": 201, + "ResponseHeaders": { + "Content-Type": "application/xml", + "Date": "Fri, 29 Jan 2021 20:36:39 GMT", + "Server": [ + "Windows-Azure-Queue/1.0", + "Microsoft-HTTPAPI/2.0" + ], + "Transfer-Encoding": "chunked", + "x-ms-request-id": "0498880f-f003-003f-7b7e-f6e32f000000", + "x-ms-version": "2018-11-09" + }, + "ResponseBody": "\uFEFF\u003C?xml version=\u00221.0\u0022 encoding=\u0022utf-8\u0022?\u003E\u003CQueueMessagesList\u003E\u003CQueueMessage\u003E\u003CMessageId\u003Ef4690291-8f13-4c53-ae0b-1a7105c15e2a\u003C/MessageId\u003E\u003CInsertionTime\u003EFri, 29 Jan 2021 20:36:39 GMT\u003C/InsertionTime\u003E\u003CExpirationTime\u003EFri, 05 Feb 2021 20:36:39 GMT\u003C/ExpirationTime\u003E\u003CPopReceipt\u003EAgAAAAMAAAAAAAAAhqZQcn721gE=\u003C/PopReceipt\u003E\u003CTimeNextVisible\u003EFri, 29 Jan 2021 20:36:39 GMT\u003C/TimeNextVisible\u003E\u003C/QueueMessage\u003E\u003C/QueueMessagesList\u003E" + }, + { + "RequestUri": "https://kasoboltest.queue.core.windows.net/test-queue-2f54b828-ad62-0c6c-49f8-153580026307/messages", + "RequestMethod": "POST", + "RequestHeaders": { + "Accept": "application/xml", + "Authorization": "Sanitized", + "Content-Length": "75", + "Content-Type": "application/xml", + "traceparent": "00-0cf3491dee0ceb48a2e384e094a148dc-284f7325630d5544-00", + "User-Agent": [ + "azsdk-net-Storage.Queues/12.7.0-alpha.20210129.1", + "(.NET Framework 4.8.4250.0; Microsoft Windows 10.0.19042 )" + ], + "x-ms-client-request-id": "cd07fa7e-fcc5-ab7a-71e4-080b553b8ffb", + "x-ms-date": "Fri, 29 Jan 2021 20:36:40 GMT", + "x-ms-return-client-request-id": "true", + "x-ms-version": "2018-11-09" + }, + "RequestBody": "\uFEFF\u003CQueueMessage\u003E\u003CMessageText\u003EdGVzdF9jb250ZW50\u003C/MessageText\u003E\u003C/QueueMessage\u003E", + "StatusCode": 201, + "ResponseHeaders": { + "Content-Type": "application/xml", + "Date": "Fri, 29 Jan 2021 20:36:39 GMT", + "Server": [ + "Windows-Azure-Queue/1.0", + "Microsoft-HTTPAPI/2.0" + ], + "Transfer-Encoding": "chunked", + "x-ms-request-id": "4e421036-2003-0050-177e-f64bfb000000", + "x-ms-version": "2018-11-09" + }, + "ResponseBody": "\uFEFF\u003C?xml version=\u00221.0\u0022 encoding=\u0022utf-8\u0022?\u003E\u003CQueueMessagesList\u003E\u003CQueueMessage\u003E\u003CMessageId\u003E00581a3b-17e9-4deb-bef7-be0bac9282b0\u003C/MessageId\u003E\u003CInsertionTime\u003EFri, 29 Jan 2021 20:36:39 GMT\u003C/InsertionTime\u003E\u003CExpirationTime\u003EFri, 05 Feb 2021 20:36:39 GMT\u003C/ExpirationTime\u003E\u003CPopReceipt\u003EAgAAAAMAAAAAAAAAXbFpcn721gE=\u003C/PopReceipt\u003E\u003CTimeNextVisible\u003EFri, 29 Jan 2021 20:36:39 GMT\u003C/TimeNextVisible\u003E\u003C/QueueMessage\u003E\u003C/QueueMessagesList\u003E" + }, + { + "RequestUri": "https://kasoboltest.queue.core.windows.net/test-queue-2f54b828-ad62-0c6c-49f8-153580026307/messages?numofmessages=10", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "application/xml", + "Authorization": "Sanitized", + "traceparent": "00-02b4d585fc94cc47bd078b9521bd27a9-b782de661de2f449-00", + "User-Agent": [ + "azsdk-net-Storage.Queues/12.7.0-alpha.20210129.1", + "(.NET Framework 4.8.4250.0; Microsoft Windows 10.0.19042 )" + ], + "x-ms-client-request-id": "3a52978d-5d01-ffac-cb3e-97f40e1fd798", + "x-ms-date": "Fri, 29 Jan 2021 20:36:40 GMT", + "x-ms-return-client-request-id": "true", + "x-ms-version": "2018-11-09" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "Cache-Control": "no-cache", + "Content-Type": "application/xml", + "Date": "Fri, 29 Jan 2021 20:36:39 GMT", + "Server": [ + "Windows-Azure-Queue/1.0", + "Microsoft-HTTPAPI/2.0" + ], + "Transfer-Encoding": "chunked", + "Vary": "Origin", + "x-ms-request-id": "4e42105a-2003-0050-337e-f64bfb000000", + "x-ms-version": "2018-11-09" + }, + "ResponseBody": "\uFEFF\u003C?xml version=\u00221.0\u0022 encoding=\u0022utf-8\u0022?\u003E\u003CQueueMessagesList\u003E\u003CQueueMessage\u003E\u003CMessageId\u003Ef4690291-8f13-4c53-ae0b-1a7105c15e2a\u003C/MessageId\u003E\u003CInsertionTime\u003EFri, 29 Jan 2021 20:36:39 GMT\u003C/InsertionTime\u003E\u003CExpirationTime\u003EFri, 05 Feb 2021 20:36:39 GMT\u003C/ExpirationTime\u003E\u003CPopReceipt\u003EAgAAAAMAAAAAAAAAE5dRhH721gE=\u003C/PopReceipt\u003E\u003CTimeNextVisible\u003EFri, 29 Jan 2021 20:37:10 GMT\u003C/TimeNextVisible\u003E\u003CDequeueCount\u003E1\u003C/DequeueCount\u003E\u003CMessageText\u003Etest_content\u003C/MessageText\u003E\u003C/QueueMessage\u003E\u003CQueueMessage\u003E\u003CMessageId\u003E00581a3b-17e9-4deb-bef7-be0bac9282b0\u003C/MessageId\u003E\u003CInsertionTime\u003EFri, 29 Jan 2021 20:36:39 GMT\u003C/InsertionTime\u003E\u003CExpirationTime\u003EFri, 05 Feb 2021 20:36:39 GMT\u003C/ExpirationTime\u003E\u003CPopReceipt\u003EAgAAAAMAAAAAAAAAE5dRhH721gE=\u003C/PopReceipt\u003E\u003CTimeNextVisible\u003EFri, 29 Jan 2021 20:37:10 GMT\u003C/TimeNextVisible\u003E\u003CDequeueCount\u003E1\u003C/DequeueCount\u003E\u003CMessageText\u003EdGVzdF9jb250ZW50\u003C/MessageText\u003E\u003C/QueueMessage\u003E\u003C/QueueMessagesList\u003E" + }, + { + "RequestUri": "https://kasoboltest.queue.core.windows.net/test-queue-2f54b828-ad62-0c6c-49f8-153580026307", + "RequestMethod": "DELETE", + "RequestHeaders": { + "Accept": "application/xml", + "Authorization": "Sanitized", + "traceparent": "00-79fc5058b044504bbecaf32b7ddcf92c-100ce876d4b5d34a-00", + "User-Agent": [ + "azsdk-net-Storage.Queues/12.7.0-alpha.20210129.1", + "(.NET Framework 4.8.4250.0; Microsoft Windows 10.0.19042 )" + ], + "x-ms-client-request-id": "be7de5a3-54e8-f4f9-6dcd-b109ac667b95", + "x-ms-date": "Fri, 29 Jan 2021 20:36:40 GMT", + "x-ms-return-client-request-id": "true", + "x-ms-version": "2018-11-09" + }, + "RequestBody": null, + "StatusCode": 204, + "ResponseHeaders": { + "Content-Length": "0", + "Date": "Fri, 29 Jan 2021 20:36:40 GMT", + "Server": [ + "Windows-Azure-Queue/1.0", + "Microsoft-HTTPAPI/2.0" + ], + "x-ms-request-id": "04988840-f003-003f-267e-f6e32f000000", + "x-ms-version": "2018-11-09" + }, + "ResponseBody": [] + } + ], + "Variables": { + "RandomSeed": "1233735287", + "Storage_TestConfigDefault": "ProductionTenant\nkasoboltest\nU2FuaXRpemVk\nhttps://kasoboltest.blob.core.windows.net\nhttps://kasoboltest.file.core.windows.net\nhttps://kasoboltest.queue.core.windows.net\nhttps://kasoboltest.table.core.windows.net\n\n\n\n\nhttps://kasoboltest-secondary.blob.core.windows.net\nhttps://kasoboltest-secondary.file.core.windows.net\nhttps://kasoboltest-secondary.queue.core.windows.net\nhttps://kasoboltest-secondary.table.core.windows.net\n\nSanitized\n\n\nCloud\nBlobEndpoint=https://kasoboltest.blob.core.windows.net/;QueueEndpoint=https://kasoboltest.queue.core.windows.net/;FileEndpoint=https://kasoboltest.file.core.windows.net/;BlobSecondaryEndpoint=https://kasoboltest-secondary.blob.core.windows.net/;QueueSecondaryEndpoint=https://kasoboltest-secondary.queue.core.windows.net/;FileSecondaryEndpoint=https://kasoboltest-secondary.file.core.windows.net/;AccountName=kasoboltest;AccountKey=Kg==;\nencryptionScope" + } +} \ No newline at end of file diff --git a/sdk/storage/Azure.Storage.Queues/tests/SessionRecords/QueueClientTests/TakesSnapshotOfMessageDecodingFailedHandlersAtConstructionAsync.json b/sdk/storage/Azure.Storage.Queues/tests/SessionRecords/QueueClientTests/TakesSnapshotOfMessageDecodingFailedHandlersAtConstructionAsync.json new file mode 100644 index 0000000000000..bb3fecb1903ed --- /dev/null +++ b/sdk/storage/Azure.Storage.Queues/tests/SessionRecords/QueueClientTests/TakesSnapshotOfMessageDecodingFailedHandlersAtConstructionAsync.json @@ -0,0 +1,167 @@ +{ + "Entries": [ + { + "RequestUri": "https://kasoboltest.queue.core.windows.net/test-queue-46e4fbf5-03ad-b8dc-19ca-63112a6dd760", + "RequestMethod": "PUT", + "RequestHeaders": { + "Accept": "application/xml", + "Authorization": "Sanitized", + "traceparent": "00-935807c46a291d458132b24ffa0da88a-fd523bb81478e349-00", + "User-Agent": [ + "azsdk-net-Storage.Queues/12.7.0-alpha.20210129.1", + "(.NET Framework 4.8.4250.0; Microsoft Windows 10.0.19042 )" + ], + "x-ms-client-request-id": "38eaaa4f-0388-cc65-7e37-89129954755e", + "x-ms-date": "Fri, 29 Jan 2021 20:36:40 GMT", + "x-ms-return-client-request-id": "true", + "x-ms-version": "2018-11-09" + }, + "RequestBody": null, + "StatusCode": 201, + "ResponseHeaders": { + "Content-Length": "0", + "Date": "Fri, 29 Jan 2021 20:36:40 GMT", + "Server": [ + "Windows-Azure-Queue/1.0", + "Microsoft-HTTPAPI/2.0" + ], + "x-ms-request-id": "4ff536e7-8003-003b-077e-f616ad000000", + "x-ms-version": "2018-11-09" + }, + "ResponseBody": [] + }, + { + "RequestUri": "https://kasoboltest.queue.core.windows.net/test-queue-46e4fbf5-03ad-b8dc-19ca-63112a6dd760/messages", + "RequestMethod": "POST", + "RequestHeaders": { + "Accept": "application/xml", + "Authorization": "Sanitized", + "Content-Length": "71", + "Content-Type": "application/xml", + "traceparent": "00-1cfa83ffad1f574eacbb7baec0fc4910-2f97c985eef8f34d-00", + "User-Agent": [ + "azsdk-net-Storage.Queues/12.7.0-alpha.20210129.1", + "(.NET Framework 4.8.4250.0; Microsoft Windows 10.0.19042 )" + ], + "x-ms-client-request-id": "80c2b8b1-9e83-afd7-7eb7-2218e5eca56e", + "x-ms-date": "Fri, 29 Jan 2021 20:36:40 GMT", + "x-ms-return-client-request-id": "true", + "x-ms-version": "2018-11-09" + }, + "RequestBody": "\uFEFF\u003CQueueMessage\u003E\u003CMessageText\u003Etest_content\u003C/MessageText\u003E\u003C/QueueMessage\u003E", + "StatusCode": 201, + "ResponseHeaders": { + "Content-Type": "application/xml", + "Date": "Fri, 29 Jan 2021 20:36:40 GMT", + "Server": [ + "Windows-Azure-Queue/1.0", + "Microsoft-HTTPAPI/2.0" + ], + "Transfer-Encoding": "chunked", + "x-ms-request-id": "4ff536eb-8003-003b-097e-f616ad000000", + "x-ms-version": "2018-11-09" + }, + "ResponseBody": "\uFEFF\u003C?xml version=\u00221.0\u0022 encoding=\u0022utf-8\u0022?\u003E\u003CQueueMessagesList\u003E\u003CQueueMessage\u003E\u003CMessageId\u003Edb63f32a-52c3-4bf7-a8ce-9cd9cc78f16e\u003C/MessageId\u003E\u003CInsertionTime\u003EFri, 29 Jan 2021 20:36:40 GMT\u003C/InsertionTime\u003E\u003CExpirationTime\u003EFri, 05 Feb 2021 20:36:40 GMT\u003C/ExpirationTime\u003E\u003CPopReceipt\u003EAgAAAAMAAAAAAAAAmNWycn721gE=\u003C/PopReceipt\u003E\u003CTimeNextVisible\u003EFri, 29 Jan 2021 20:36:40 GMT\u003C/TimeNextVisible\u003E\u003C/QueueMessage\u003E\u003C/QueueMessagesList\u003E" + }, + { + "RequestUri": "https://kasoboltest.queue.core.windows.net/test-queue-46e4fbf5-03ad-b8dc-19ca-63112a6dd760/messages", + "RequestMethod": "POST", + "RequestHeaders": { + "Accept": "application/xml", + "Authorization": "Sanitized", + "Content-Length": "75", + "Content-Type": "application/xml", + "traceparent": "00-180db3da1229534c8faea39f6e077c09-7e3785fe418f8d42-00", + "User-Agent": [ + "azsdk-net-Storage.Queues/12.7.0-alpha.20210129.1", + "(.NET Framework 4.8.4250.0; Microsoft Windows 10.0.19042 )" + ], + "x-ms-client-request-id": "e1614279-f591-7bdb-6833-2745f5bca00f", + "x-ms-date": "Fri, 29 Jan 2021 20:36:40 GMT", + "x-ms-return-client-request-id": "true", + "x-ms-version": "2018-11-09" + }, + "RequestBody": "\uFEFF\u003CQueueMessage\u003E\u003CMessageText\u003EdGVzdF9jb250ZW50\u003C/MessageText\u003E\u003C/QueueMessage\u003E", + "StatusCode": 201, + "ResponseHeaders": { + "Content-Type": "application/xml", + "Date": "Fri, 29 Jan 2021 20:36:40 GMT", + "Server": [ + "Windows-Azure-Queue/1.0", + "Microsoft-HTTPAPI/2.0" + ], + "Transfer-Encoding": "chunked", + "x-ms-request-id": "5cb52823-b003-0011-0f7e-f663e8000000", + "x-ms-version": "2018-11-09" + }, + "ResponseBody": "\uFEFF\u003C?xml version=\u00221.0\u0022 encoding=\u0022utf-8\u0022?\u003E\u003CQueueMessagesList\u003E\u003CQueueMessage\u003E\u003CMessageId\u003Eb4305927-95c0-46f0-b913-aa07978a6bc8\u003C/MessageId\u003E\u003CInsertionTime\u003EFri, 29 Jan 2021 20:36:40 GMT\u003C/InsertionTime\u003E\u003CExpirationTime\u003EFri, 05 Feb 2021 20:36:40 GMT\u003C/ExpirationTime\u003E\u003CPopReceipt\u003EAgAAAAMAAAAAAAAAk9LIcn721gE=\u003C/PopReceipt\u003E\u003CTimeNextVisible\u003EFri, 29 Jan 2021 20:36:40 GMT\u003C/TimeNextVisible\u003E\u003C/QueueMessage\u003E\u003C/QueueMessagesList\u003E" + }, + { + "RequestUri": "https://kasoboltest.queue.core.windows.net/test-queue-46e4fbf5-03ad-b8dc-19ca-63112a6dd760/messages?numofmessages=10", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "application/xml", + "Authorization": "Sanitized", + "traceparent": "00-91e301ad3e30c64786bbf57a056003e0-b64f4eee03b8164a-00", + "User-Agent": [ + "azsdk-net-Storage.Queues/12.7.0-alpha.20210129.1", + "(.NET Framework 4.8.4250.0; Microsoft Windows 10.0.19042 )" + ], + "x-ms-client-request-id": "a29f4beb-c48b-2cdc-c79f-51bd4b694017", + "x-ms-date": "Fri, 29 Jan 2021 20:36:40 GMT", + "x-ms-return-client-request-id": "true", + "x-ms-version": "2018-11-09" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "Cache-Control": "no-cache", + "Content-Type": "application/xml", + "Date": "Fri, 29 Jan 2021 20:36:40 GMT", + "Server": [ + "Windows-Azure-Queue/1.0", + "Microsoft-HTTPAPI/2.0" + ], + "Transfer-Encoding": "chunked", + "Vary": "Origin", + "x-ms-request-id": "5cb52831-b003-0011-187e-f663e8000000", + "x-ms-version": "2018-11-09" + }, + "ResponseBody": "\uFEFF\u003C?xml version=\u00221.0\u0022 encoding=\u0022utf-8\u0022?\u003E\u003CQueueMessagesList\u003E\u003CQueueMessage\u003E\u003CMessageId\u003Edb63f32a-52c3-4bf7-a8ce-9cd9cc78f16e\u003C/MessageId\u003E\u003CInsertionTime\u003EFri, 29 Jan 2021 20:36:40 GMT\u003C/InsertionTime\u003E\u003CExpirationTime\u003EFri, 05 Feb 2021 20:36:40 GMT\u003C/ExpirationTime\u003E\u003CPopReceipt\u003EAgAAAAMAAAAAAAAAH7yuhH721gE=\u003C/PopReceipt\u003E\u003CTimeNextVisible\u003EFri, 29 Jan 2021 20:37:10 GMT\u003C/TimeNextVisible\u003E\u003CDequeueCount\u003E1\u003C/DequeueCount\u003E\u003CMessageText\u003Etest_content\u003C/MessageText\u003E\u003C/QueueMessage\u003E\u003CQueueMessage\u003E\u003CMessageId\u003Eb4305927-95c0-46f0-b913-aa07978a6bc8\u003C/MessageId\u003E\u003CInsertionTime\u003EFri, 29 Jan 2021 20:36:40 GMT\u003C/InsertionTime\u003E\u003CExpirationTime\u003EFri, 05 Feb 2021 20:36:40 GMT\u003C/ExpirationTime\u003E\u003CPopReceipt\u003EAgAAAAMAAAAAAAAAH7yuhH721gE=\u003C/PopReceipt\u003E\u003CTimeNextVisible\u003EFri, 29 Jan 2021 20:37:10 GMT\u003C/TimeNextVisible\u003E\u003CDequeueCount\u003E1\u003C/DequeueCount\u003E\u003CMessageText\u003EdGVzdF9jb250ZW50\u003C/MessageText\u003E\u003C/QueueMessage\u003E\u003C/QueueMessagesList\u003E" + }, + { + "RequestUri": "https://kasoboltest.queue.core.windows.net/test-queue-46e4fbf5-03ad-b8dc-19ca-63112a6dd760", + "RequestMethod": "DELETE", + "RequestHeaders": { + "Accept": "application/xml", + "Authorization": "Sanitized", + "traceparent": "00-bec3b640b7f08e449134cb66472e74a3-d5728527c9941245-00", + "User-Agent": [ + "azsdk-net-Storage.Queues/12.7.0-alpha.20210129.1", + "(.NET Framework 4.8.4250.0; Microsoft Windows 10.0.19042 )" + ], + "x-ms-client-request-id": "a959f903-fe1d-3c84-38c6-95ecb299f29f", + "x-ms-date": "Fri, 29 Jan 2021 20:36:40 GMT", + "x-ms-return-client-request-id": "true", + "x-ms-version": "2018-11-09" + }, + "RequestBody": null, + "StatusCode": 204, + "ResponseHeaders": { + "Content-Length": "0", + "Date": "Fri, 29 Jan 2021 20:36:40 GMT", + "Server": [ + "Windows-Azure-Queue/1.0", + "Microsoft-HTTPAPI/2.0" + ], + "x-ms-request-id": "4ff536f1-8003-003b-0d7e-f616ad000000", + "x-ms-version": "2018-11-09" + }, + "ResponseBody": [] + } + ], + "Variables": { + "RandomSeed": "1369471692", + "Storage_TestConfigDefault": "ProductionTenant\nkasoboltest\nU2FuaXRpemVk\nhttps://kasoboltest.blob.core.windows.net\nhttps://kasoboltest.file.core.windows.net\nhttps://kasoboltest.queue.core.windows.net\nhttps://kasoboltest.table.core.windows.net\n\n\n\n\nhttps://kasoboltest-secondary.blob.core.windows.net\nhttps://kasoboltest-secondary.file.core.windows.net\nhttps://kasoboltest-secondary.queue.core.windows.net\nhttps://kasoboltest-secondary.table.core.windows.net\n\nSanitized\n\n\nCloud\nBlobEndpoint=https://kasoboltest.blob.core.windows.net/;QueueEndpoint=https://kasoboltest.queue.core.windows.net/;FileEndpoint=https://kasoboltest.file.core.windows.net/;BlobSecondaryEndpoint=https://kasoboltest-secondary.blob.core.windows.net/;QueueSecondaryEndpoint=https://kasoboltest-secondary.queue.core.windows.net/;FileSecondaryEndpoint=https://kasoboltest-secondary.file.core.windows.net/;AccountName=kasoboltest;AccountKey=Kg==;\nencryptionScope" + } +} \ No newline at end of file From 46f69cb0f38589d999ddf77d02836120cc0f7a10 Mon Sep 17 00:00:00 2001 From: Kamil Sobol Date: Fri, 29 Jan 2021 12:55:25 -0800 Subject: [PATCH 26/27] protected onevent thing. --- .../Azure.Storage.Queues.netstandard2.0.cs | 4 +- .../Azure.Storage.Queues/src/QueueClient.cs | 53 ++++++++++++------- .../QueueMessageDecodingFailedEventArgs.cs | 47 +++------------- 3 files changed, 44 insertions(+), 60 deletions(-) diff --git a/sdk/storage/Azure.Storage.Queues/api/Azure.Storage.Queues.netstandard2.0.cs b/sdk/storage/Azure.Storage.Queues/api/Azure.Storage.Queues.netstandard2.0.cs index 264703dd93244..5b1cd3d312c33 100644 --- a/sdk/storage/Azure.Storage.Queues/api/Azure.Storage.Queues.netstandard2.0.cs +++ b/sdk/storage/Azure.Storage.Queues/api/Azure.Storage.Queues.netstandard2.0.cs @@ -37,6 +37,7 @@ public QueueClient(System.Uri queueUri, Azure.Storage.StorageSharedKeyCredential protected internal virtual Azure.Storage.Queues.QueueServiceClient GetParentQueueServiceClientCore() { throw null; } public virtual Azure.Response GetProperties(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task> GetPropertiesAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + protected virtual System.Threading.Tasks.Task OnMessageDecodingFailedAsync(Azure.Storage.Queues.Models.QueueMessage receivedMessage, Azure.Storage.Queues.Models.PeekedMessage peekedMessage, bool runSynchronously, System.Threading.CancellationToken cancellationToken) { throw null; } public virtual Azure.Response PeekMessage(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task> PeekMessageAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Response PeekMessages(int? maxMessages = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } @@ -85,8 +86,7 @@ public enum ServiceVersion } public partial class QueueMessageDecodingFailedEventArgs : Azure.SyncAsyncEventArgs { - public QueueMessageDecodingFailedEventArgs(Azure.Storage.Queues.QueueClient queueClient, Azure.Storage.Queues.Models.PeekedMessage message, bool runSynchronously, System.Threading.CancellationToken cancellationToken) : base (default(bool), default(System.Threading.CancellationToken)) { } - public QueueMessageDecodingFailedEventArgs(Azure.Storage.Queues.QueueClient queueClient, Azure.Storage.Queues.Models.QueueMessage message, bool runSynchronously, System.Threading.CancellationToken cancellationToken) : base (default(bool), default(System.Threading.CancellationToken)) { } + public QueueMessageDecodingFailedEventArgs(Azure.Storage.Queues.QueueClient queueClient, Azure.Storage.Queues.Models.QueueMessage receivedMessage, Azure.Storage.Queues.Models.PeekedMessage peekedMessage, bool runSynchronously, System.Threading.CancellationToken cancellationToken) : base (default(bool), default(System.Threading.CancellationToken)) { } public Azure.Storage.Queues.Models.PeekedMessage PeekedMessage { get { throw null; } } public Azure.Storage.Queues.QueueClient Queue { get { throw null; } } public Azure.Storage.Queues.Models.QueueMessage ReceivedMessage { get { throw null; } } diff --git a/sdk/storage/Azure.Storage.Queues/src/QueueClient.cs b/sdk/storage/Azure.Storage.Queues/src/QueueClient.cs index 7ab43c2d95155..efdd756066b10 100644 --- a/sdk/storage/Azure.Storage.Queues/src/QueueClient.cs +++ b/sdk/storage/Azure.Storage.Queues/src/QueueClient.cs @@ -2248,15 +2248,11 @@ private async Task ToQueueMessagesWithInvalidMessageHandling( catch (FormatException) when (ClientConfiguration.QueueMessageDecodingFailedHandlers != null) { #pragma warning disable AZC0110 // DO NOT use await keyword in possibly synchronous scope. - await ClientConfiguration.QueueMessageDecodingFailedHandlers.RaiseAsync( - new QueueMessageDecodingFailedEventArgs( - queueClient: this, - message: QueueMessage.ToQueueMessage(dequeuedMessageItem, QueueMessageEncoding.None), - runSynchronously: !async, - cancellationToken: cancellationToken), - nameof(QueueClientOptions), - nameof(QueueClientOptions.MessageDecodingFailed), - ClientConfiguration.ClientDiagnostics).ConfigureAwait(false); + await OnMessageDecodingFailedAsync( + QueueMessage.ToQueueMessage(dequeuedMessageItem, QueueMessageEncoding.None), + null, + !async, + cancellationToken).ConfigureAwait(false); #pragma warning restore AZC0110 // DO NOT use await keyword in possibly synchronous scope. } } @@ -2600,15 +2596,11 @@ private async Task ToPeekedMessagesWithInvalidMessageHandling( catch (FormatException) when (ClientConfiguration.QueueMessageDecodingFailedHandlers != null) { #pragma warning disable AZC0110 // DO NOT use await keyword in possibly synchronous scope. - await ClientConfiguration.QueueMessageDecodingFailedHandlers.RaiseAsync( - new QueueMessageDecodingFailedEventArgs( - queueClient: this, - message: PeekedMessage.ToPeekedMessage(peekedMessageItem, QueueMessageEncoding.None), - runSynchronously: !async, - cancellationToken: cancellationToken), - nameof(QueueClientOptions), - nameof(QueueClientOptions.MessageDecodingFailed), - ClientConfiguration.ClientDiagnostics).ConfigureAwait(false); + await OnMessageDecodingFailedAsync( + null, + PeekedMessage.ToPeekedMessage(peekedMessageItem, QueueMessageEncoding.None), + !async, + cancellationToken).ConfigureAwait(false); #pragma warning restore AZC0110 // DO NOT use await keyword in possibly synchronous scope. } } @@ -3165,6 +3157,31 @@ private void AssertEncodingForEncryption() $" if {nameof(SpecializedQueueClientOptions.ClientSideEncryption)} is enabled as encrypted payload is already Base64 encoded."); } } + + /// + /// Raises event. + /// + /// The with raw body, if present. + /// The with raw body, if present. + /// A value indicating whether the event handler was invoked + /// synchronously or asynchronously. + /// Cancellation token. + /// + protected virtual async Task OnMessageDecodingFailedAsync(QueueMessage receivedMessage, PeekedMessage peekedMessage, + bool runSynchronously, CancellationToken cancellationToken) + { + await ClientConfiguration.QueueMessageDecodingFailedHandlers.RaiseAsync( + new QueueMessageDecodingFailedEventArgs( + queueClient: this, + receivedMessage: receivedMessage, + peekedMessage: peekedMessage, + runSynchronously: runSynchronously, + cancellationToken: cancellationToken), + nameof(QueueClientOptions), + nameof(QueueClientOptions.MessageDecodingFailed), + ClientConfiguration.ClientDiagnostics).ConfigureAwait(false); + } + #endregion Encoding #region GetParentQueueServiceClientCore diff --git a/sdk/storage/Azure.Storage.Queues/src/QueueMessageDecodingFailedEventArgs.cs b/sdk/storage/Azure.Storage.Queues/src/QueueMessageDecodingFailedEventArgs.cs index 82164ef3d2894..a48179fb47a2f 100644 --- a/sdk/storage/Azure.Storage.Queues/src/QueueMessageDecodingFailedEventArgs.cs +++ b/sdk/storage/Azure.Storage.Queues/src/QueueMessageDecodingFailedEventArgs.cs @@ -34,7 +34,8 @@ public class QueueMessageDecodingFailedEventArgs : SyncAsyncEventArgs /// Initializes a new instance of the . /// /// The that has received invalid message. - /// The invalid message. + /// The received message. + /// The peeked message. /// /// A value indicating whether the event handler was invoked /// synchronously or asynchronously. Please see @@ -48,54 +49,20 @@ public class QueueMessageDecodingFailedEventArgs : SyncAsyncEventArgs /// default value is . /// /// - /// Thrown if or - /// are null. + /// Thrown if is null. /// public QueueMessageDecodingFailedEventArgs( QueueClient queueClient, - QueueMessage message, + QueueMessage receivedMessage, + PeekedMessage peekedMessage, bool runSynchronously, CancellationToken cancellationToken) : base(runSynchronously, cancellationToken) { Argument.AssertNotNull(queueClient, nameof(queueClient)); - Argument.AssertNotNull(message, nameof(message)); Queue = queueClient; - ReceivedMessage = message; - } - - /// - /// Initializes a new instance of the . - /// - /// The that has received invalid message. - /// The invalid message. - /// - /// A value indicating whether the event handler was invoked - /// synchronously or asynchronously. Please see - /// for more details. - /// - /// - /// A cancellation token related to the original operation that raised - /// the event. It's important for your handler to pass this token - /// along to any asynchronous or long-running synchronous operations - /// that take a token so cancellation will correctly propagate. The - /// default value is . - /// - /// - /// Thrown if or - /// are null. - /// - public QueueMessageDecodingFailedEventArgs( - QueueClient queueClient, - PeekedMessage message, - bool runSynchronously, - CancellationToken cancellationToken) - : base(runSynchronously, cancellationToken) - { - Argument.AssertNotNull(queueClient, nameof(queueClient)); - Argument.AssertNotNull(message, nameof(message)); - Queue = queueClient; - PeekedMessage = message; + ReceivedMessage = receivedMessage; + PeekedMessage = peekedMessage; } } } From 523d8869da055036de22b0763b56950a863f9506 Mon Sep 17 00:00:00 2001 From: Kamil Sobol Date: Fri, 29 Jan 2021 13:03:28 -0800 Subject: [PATCH 27/27] post merge. --- sdk/storage/Azure.Storage.Queues/src/QueueClient.cs | 3 ++- .../CanGetParentQueueServiceClient_WithAccountSAS.json | 2 +- .../CanGetParentQueueServiceClient_WithAccountSASAsync.json | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/sdk/storage/Azure.Storage.Queues/src/QueueClient.cs b/sdk/storage/Azure.Storage.Queues/src/QueueClient.cs index e94b5fc6864a0..d7aa3f63c355e 100644 --- a/sdk/storage/Azure.Storage.Queues/src/QueueClient.cs +++ b/sdk/storage/Azure.Storage.Queues/src/QueueClient.cs @@ -443,7 +443,8 @@ protected internal virtual QueueClient WithClientSideEncryptionOptionsCore(Clien ClientConfiguration.ClientDiagnostics, ClientConfiguration.Version, QueueClientSideEncryptionOptions.CloneFrom(clientSideEncryptionOptions), - ClientConfiguration.MessageEncoding); + ClientConfiguration.MessageEncoding, + ClientConfiguration.QueueMessageDecodingFailedHandlers); return new QueueClient( Uri, diff --git a/sdk/storage/Azure.Storage.Queues/tests/SessionRecords/QueueClientTests/CanGetParentQueueServiceClient_WithAccountSAS.json b/sdk/storage/Azure.Storage.Queues/tests/SessionRecords/QueueClientTests/CanGetParentQueueServiceClient_WithAccountSAS.json index f799391531ac5..c4c9d02feee6d 100644 --- a/sdk/storage/Azure.Storage.Queues/tests/SessionRecords/QueueClientTests/CanGetParentQueueServiceClient_WithAccountSAS.json +++ b/sdk/storage/Azure.Storage.Queues/tests/SessionRecords/QueueClientTests/CanGetParentQueueServiceClient_WithAccountSAS.json @@ -1,7 +1,7 @@ { "Entries": [ { - "RequestUri": "https://kasoboltest.queue.core.windows.net/?sv=2020-04-08\u0026ss=q\u0026srt=sco\u0026st=2021-01-27T23:35:29Z\u0026se=2021-01-28T01:35:29Z\u0026sp=rwdlaup\u0026sig=Sanitized\u0026restype=service\u0026comp=properties", + "RequestUri": "https://kasoboltest.queue.core.windows.net/?sv=2020-06-12\u0026ss=q\u0026srt=sco\u0026st=2021-01-27T23:35:29Z\u0026se=2021-01-28T01:35:29Z\u0026sp=rwdlaup\u0026sig=Sanitized\u0026restype=service\u0026comp=properties", "RequestMethod": "GET", "RequestHeaders": { "Accept": "application/xml", diff --git a/sdk/storage/Azure.Storage.Queues/tests/SessionRecords/QueueClientTests/CanGetParentQueueServiceClient_WithAccountSASAsync.json b/sdk/storage/Azure.Storage.Queues/tests/SessionRecords/QueueClientTests/CanGetParentQueueServiceClient_WithAccountSASAsync.json index 747658e7e18b3..d9a4c8a6895fb 100644 --- a/sdk/storage/Azure.Storage.Queues/tests/SessionRecords/QueueClientTests/CanGetParentQueueServiceClient_WithAccountSASAsync.json +++ b/sdk/storage/Azure.Storage.Queues/tests/SessionRecords/QueueClientTests/CanGetParentQueueServiceClient_WithAccountSASAsync.json @@ -1,7 +1,7 @@ { "Entries": [ { - "RequestUri": "https://kasoboltest.queue.core.windows.net/?sv=2020-04-08\u0026ss=q\u0026srt=sco\u0026st=2021-01-27T23:35:30Z\u0026se=2021-01-28T01:35:30Z\u0026sp=rwdlaup\u0026sig=Sanitized\u0026restype=service\u0026comp=properties", + "RequestUri": "https://kasoboltest.queue.core.windows.net/?sv=2020-06-12\u0026ss=q\u0026srt=sco\u0026st=2021-01-27T23:35:30Z\u0026se=2021-01-28T01:35:30Z\u0026sp=rwdlaup\u0026sig=Sanitized\u0026restype=service\u0026comp=properties", "RequestMethod": "GET", "RequestHeaders": { "Accept": "application/xml",