From a6c3e5957f75c82dc42260b94e33c302eacf5953 Mon Sep 17 00:00:00 2001 From: JoshLove-msft <54595583+JoshLove-msft@users.noreply.github.com> Date: Fri, 19 Apr 2024 08:21:11 -0700 Subject: [PATCH] Respect SupportsOrdering property (#43531) * Respect SupportsOrdering property * typo * Add test cases --- sdk/servicebus/Azure.Messaging.ServiceBus/CHANGELOG.md | 2 ++ sdk/servicebus/Azure.Messaging.ServiceBus/assets.json | 2 +- .../src/Administration/CreateTopicOptions.cs | 4 +++- .../src/Administration/TopicProperties.cs | 1 + .../ServiceBusManagementClientLiveTests.cs | 9 ++++++--- 5 files changed, 13 insertions(+), 5 deletions(-) diff --git a/sdk/servicebus/Azure.Messaging.ServiceBus/CHANGELOG.md b/sdk/servicebus/Azure.Messaging.ServiceBus/CHANGELOG.md index 66891f6753eff..8bafcf303c133 100644 --- a/sdk/servicebus/Azure.Messaging.ServiceBus/CHANGELOG.md +++ b/sdk/servicebus/Azure.Messaging.ServiceBus/CHANGELOG.md @@ -8,6 +8,8 @@ ### Bugs Fixed +- Fixed issue where the `SupportOrdering` property was not being respected when set on `CreateTopicOptions`. + ### Other Changes ## 7.17.5 (2024-04-09) diff --git a/sdk/servicebus/Azure.Messaging.ServiceBus/assets.json b/sdk/servicebus/Azure.Messaging.ServiceBus/assets.json index 4a8c80d32c2cd..30f5014ed11a0 100644 --- a/sdk/servicebus/Azure.Messaging.ServiceBus/assets.json +++ b/sdk/servicebus/Azure.Messaging.ServiceBus/assets.json @@ -2,5 +2,5 @@ "AssetsRepo": "Azure/azure-sdk-assets", "AssetsRepoPrefixPath": "net", "TagPrefix": "net/servicebus/Azure.Messaging.ServiceBus", - "Tag": "net/servicebus/Azure.Messaging.ServiceBus_36f6f28db7" + "Tag": "net/servicebus/Azure.Messaging.ServiceBus_2c5f4fe7c3" } diff --git a/sdk/servicebus/Azure.Messaging.ServiceBus/src/Administration/CreateTopicOptions.cs b/sdk/servicebus/Azure.Messaging.ServiceBus/src/Administration/CreateTopicOptions.cs index 421ce7d2522a1..b85406192bca0 100644 --- a/sdk/servicebus/Azure.Messaging.ServiceBus/src/Administration/CreateTopicOptions.cs +++ b/sdk/servicebus/Azure.Messaging.ServiceBus/src/Administration/CreateTopicOptions.cs @@ -45,6 +45,7 @@ public CreateTopicOptions(TopicProperties topic) Status = topic.Status; EnablePartitioning = topic.EnablePartitioning; MaxMessageSizeInKilobytes = topic.MaxMessageSizeInKilobytes; + SupportOrdering = topic.SupportOrdering; if (topic.UserMetadata != null) { UserMetadata = topic.UserMetadata; @@ -233,7 +234,8 @@ public bool Equals(CreateTopicOptions other) && (AuthorizationRules != null && otherOptions.AuthorizationRules != null || AuthorizationRules == null && otherOptions.AuthorizationRules == null) && (AuthorizationRules == null || AuthorizationRules.Equals(otherOptions.AuthorizationRules)) - && MaxMessageSizeInKilobytes.Equals(other.MaxMessageSizeInKilobytes)) + && MaxMessageSizeInKilobytes.Equals(other.MaxMessageSizeInKilobytes) + && SupportOrdering == otherOptions.SupportOrdering) { return true; } diff --git a/sdk/servicebus/Azure.Messaging.ServiceBus/src/Administration/TopicProperties.cs b/sdk/servicebus/Azure.Messaging.ServiceBus/src/Administration/TopicProperties.cs index 651ef0583a5d4..632f17eacb55e 100644 --- a/sdk/servicebus/Azure.Messaging.ServiceBus/src/Administration/TopicProperties.cs +++ b/sdk/servicebus/Azure.Messaging.ServiceBus/src/Administration/TopicProperties.cs @@ -45,6 +45,7 @@ internal TopicProperties(CreateTopicOptions options) Status = options.Status; EnableBatchedOperations = options.EnableBatchedOperations; EnablePartitioning = options.EnablePartitioning; + SupportOrdering = options.SupportOrdering; if (options.UserMetadata != null) { UserMetadata = options.UserMetadata; diff --git a/sdk/servicebus/Azure.Messaging.ServiceBus/tests/Administration/ServiceBusManagementClientLiveTests.cs b/sdk/servicebus/Azure.Messaging.ServiceBus/tests/Administration/ServiceBusManagementClientLiveTests.cs index 063a6d189edf9..88465ef4effab 100644 --- a/sdk/servicebus/Azure.Messaging.ServiceBus/tests/Administration/ServiceBusManagementClientLiveTests.cs +++ b/sdk/servicebus/Azure.Messaging.ServiceBus/tests/Administration/ServiceBusManagementClientLiveTests.cs @@ -223,9 +223,11 @@ await client.GetQueueAsync(queueOptions.Name), } [RecordedTest] - [TestCase(false)] - [TestCase(true)] - public async Task BasicTopicCrudOperations(bool premium) + [TestCase(false, false)] + [TestCase(false, true)] + [TestCase(true, false)] + [TestCase(true, true)] + public async Task BasicTopicCrudOperations(bool premium, bool supportOrdering) { var topicName = nameof(BasicTopicCrudOperations).ToLower() + Recording.Random.NewGuid().ToString("D").Substring(0, 8); var client = CreateClient(premium); @@ -240,6 +242,7 @@ public async Task BasicTopicCrudOperations(bool premium) MaxSizeInMegabytes = 1024, RequiresDuplicateDetection = true, UserMetadata = nameof(BasicTopicCrudOperations), + SupportOrdering = supportOrdering }; if (CanSetMaxMessageSize(premium))