From ec2efa5c3f0d3199f5bfb34def489e4c925e3518 Mon Sep 17 00:00:00 2001 From: Richard Park Date: Fri, 2 Apr 2021 15:49:09 -0700 Subject: [PATCH 01/13] Fixing an issue where our property ordering makes it so our edits appear to take effect but don't actually alter the entity. Fixes #14539 --- .../serializers/queueResourceSerializer.ts | 25 ++++++++++++++++--- .../subscriptionResourceSerializer.ts | 7 ++++++ .../serializers/topicResourceSerializer.ts | 11 ++++++++ 3 files changed, 39 insertions(+), 4 deletions(-) diff --git a/sdk/servicebus/service-bus/src/serializers/queueResourceSerializer.ts b/sdk/servicebus/service-bus/src/serializers/queueResourceSerializer.ts index 216d867363c4..a2e998ef096f 100644 --- a/sdk/servicebus/service-bus/src/serializers/queueResourceSerializer.ts +++ b/sdk/servicebus/service-bus/src/serializers/queueResourceSerializer.ts @@ -31,6 +31,13 @@ import { */ export function buildQueueOptions(queue: CreateQueueOptions): InternalQueueOptions { return { + // NOTE: this ordering is extremely important. As an example, misordering of the ForwardTo property + // resulted in a customer bug where the Forwarding attributes appeared to be set but the portal was + // not picking up on it. + // + // The authority on this ordering is here: + // https://github.com/Azure/azure-sdk-for-net/blob/master/sdk/servicebus/Azure.Messaging.ServiceBus/src/Administration/QueuePropertiesExtensions.cs#L20 + LockDuration: queue.lockDuration, MaxSizeInMegabytes: getStringOrUndefined(queue.maxSizeInMegabytes), RequiresDuplicateDetection: getStringOrUndefined(queue.requiresDuplicateDetection), @@ -40,15 +47,25 @@ export function buildQueueOptions(queue: CreateQueueOptions): InternalQueueOptio DuplicateDetectionHistoryTimeWindow: queue.duplicateDetectionHistoryTimeWindow, MaxDeliveryCount: getStringOrUndefined(queue.maxDeliveryCount), EnableBatchedOperations: getStringOrUndefined(queue.enableBatchedOperations), - AuthorizationRules: getRawAuthorizationRules(queue.authorizationRules), + + // TODO: found while syncing the ordering. This property is in .net, but not in ours? + //IsAnonymousAccessible: false, + + AuthorizationRules: getRawAuthorizationRules(queue.authorizationRules), Status: getStringOrUndefined(queue.status), + ForwardTo: getStringOrUndefined(queue.forwardTo), + UserMetadata: getStringOrUndefined(queue.userMetadata), + + // TODO: found while syncing the ordering. This property is in .net, but not in ours? + // SupportOrdering: true, + AutoDeleteOnIdle: getStringOrUndefined(queue.autoDeleteOnIdle), EnablePartitioning: getStringOrUndefined(queue.enablePartitioning), ForwardDeadLetteredMessagesTo: getStringOrUndefined(queue.forwardDeadLetteredMessagesTo), - ForwardTo: getStringOrUndefined(queue.forwardTo), - UserMetadata: getStringOrUndefined(queue.userMetadata), + + // TODO: can't find this in the .net ATOM library. EntityAvailabilityStatus: getStringOrUndefined(queue.availabilityStatus), - EnableExpress: getStringOrUndefined(queue.enableExpress) + EnableExpress: getStringOrUndefined(queue.enableExpress), }; } diff --git a/sdk/servicebus/service-bus/src/serializers/subscriptionResourceSerializer.ts b/sdk/servicebus/service-bus/src/serializers/subscriptionResourceSerializer.ts index 6c3d6c9badde..d1592ae6ffab 100644 --- a/sdk/servicebus/service-bus/src/serializers/subscriptionResourceSerializer.ts +++ b/sdk/servicebus/service-bus/src/serializers/subscriptionResourceSerializer.ts @@ -36,6 +36,12 @@ export function buildSubscriptionOptions( subscription: CreateSubscriptionOptions ): InternalSubscriptionOptions { return { + // NOTE: this ordering is extremely important. As an example, misordering of the ForwardTo property + // resulted in a customer bug where the Forwarding attributes appeared to be set but the portal was + // not picking up on it. + // + // The authority on this ordering is here: + // https://github.com/Azure/azure-sdk-for-net/blob/master/sdk/servicebus/Azure.Messaging.ServiceBus/src/Administration/SubscriptionPropertiesExtensions.cs#L191 LockDuration: subscription.lockDuration, RequiresSession: getStringOrUndefined(subscription.requiresSession), DefaultMessageTimeToLive: getStringOrUndefined(subscription.defaultMessageTimeToLive), @@ -55,6 +61,7 @@ export function buildSubscriptionOptions( UserMetadata: getStringOrUndefined(subscription.userMetadata), ForwardDeadLetteredMessagesTo: getStringOrUndefined(subscription.forwardDeadLetteredMessagesTo), AutoDeleteOnIdle: getStringOrUndefined(subscription.autoDeleteOnIdle), + // TODO: EntityAvailabilityStatus does not exist in .net EntityAvailabilityStatus: getStringOrUndefined(subscription.availabilityStatus) }; } diff --git a/sdk/servicebus/service-bus/src/serializers/topicResourceSerializer.ts b/sdk/servicebus/service-bus/src/serializers/topicResourceSerializer.ts index f0816413e8b8..1c301d1633d8 100644 --- a/sdk/servicebus/service-bus/src/serializers/topicResourceSerializer.ts +++ b/sdk/servicebus/service-bus/src/serializers/topicResourceSerializer.ts @@ -31,17 +31,28 @@ import { */ export function buildTopicOptions(topic: CreateTopicOptions): InternalTopicOptions { return { + // NOTE: this ordering is extremely important. As an example, misordering of the ForwardTo property + // resulted in a customer bug where the Forwarding attributes appeared to be set but the portal was + // not picking up on it. + // + // The authority on this ordering is here: + // https://github.com/Azure/azure-sdk-for-net/blob/master/sdk/servicebus/Azure.Messaging.ServiceBus/src/Administration/TopicPropertiesExtensions.cs#L175 + DefaultMessageTimeToLive: topic.defaultMessageTimeToLive, MaxSizeInMegabytes: getStringOrUndefined(topic.maxSizeInMegabytes), RequiresDuplicateDetection: getStringOrUndefined(topic.requiresDuplicateDetection), DuplicateDetectionHistoryTimeWindow: topic.duplicateDetectionHistoryTimeWindow, EnableBatchedOperations: getStringOrUndefined(topic.enableBatchedOperations), + // TODO: in .net, but not in here: FilteringMessagesBeforePublishing + // TODO: in .net, but not in here: IsAnonymousAccessible AuthorizationRules: getRawAuthorizationRules(topic.authorizationRules), Status: getStringOrUndefined(topic.status), + // TODO: in .net, but not in here: ForwardTo UserMetadata: getStringOrUndefined(topic.userMetadata), SupportOrdering: getStringOrUndefined(topic.supportOrdering), AutoDeleteOnIdle: getStringOrUndefined(topic.autoDeleteOnIdle), EnablePartitioning: getStringOrUndefined(topic.enablePartitioning), + // TODO: in .net, but not in here: EnableSubscriptionPartitioning EntityAvailabilityStatus: getStringOrUndefined(topic.availabilityStatus), EnableExpress: getStringOrUndefined(topic.enableExpress) }; From d54f62aa55e58d3024427811a62df125f7a01659 Mon Sep 17 00:00:00 2001 From: Richard Park Date: Fri, 2 Apr 2021 16:14:27 -0700 Subject: [PATCH 02/13] Remove TODO comment about SupportOrdering - it's a legacy property and is omitted purposefuly. --- .../service-bus/src/serializers/queueResourceSerializer.ts | 4 ---- 1 file changed, 4 deletions(-) diff --git a/sdk/servicebus/service-bus/src/serializers/queueResourceSerializer.ts b/sdk/servicebus/service-bus/src/serializers/queueResourceSerializer.ts index a2e998ef096f..622540d93893 100644 --- a/sdk/servicebus/service-bus/src/serializers/queueResourceSerializer.ts +++ b/sdk/servicebus/service-bus/src/serializers/queueResourceSerializer.ts @@ -55,10 +55,6 @@ export function buildQueueOptions(queue: CreateQueueOptions): InternalQueueOptio Status: getStringOrUndefined(queue.status), ForwardTo: getStringOrUndefined(queue.forwardTo), UserMetadata: getStringOrUndefined(queue.userMetadata), - - // TODO: found while syncing the ordering. This property is in .net, but not in ours? - // SupportOrdering: true, - AutoDeleteOnIdle: getStringOrUndefined(queue.autoDeleteOnIdle), EnablePartitioning: getStringOrUndefined(queue.enablePartitioning), ForwardDeadLetteredMessagesTo: getStringOrUndefined(queue.forwardDeadLetteredMessagesTo), From 12e3508844679255fb6bebcd49a46cc719825647 Mon Sep 17 00:00:00 2001 From: Richard Park Date: Fri, 2 Apr 2021 16:15:47 -0700 Subject: [PATCH 03/13] Removing some more fields (legacy again) --- .../service-bus/src/serializers/queueResourceSerializer.ts | 4 ---- .../service-bus/src/serializers/topicResourceSerializer.ts | 1 - 2 files changed, 5 deletions(-) diff --git a/sdk/servicebus/service-bus/src/serializers/queueResourceSerializer.ts b/sdk/servicebus/service-bus/src/serializers/queueResourceSerializer.ts index 622540d93893..6cfe0ce6ffdb 100644 --- a/sdk/servicebus/service-bus/src/serializers/queueResourceSerializer.ts +++ b/sdk/servicebus/service-bus/src/serializers/queueResourceSerializer.ts @@ -47,10 +47,6 @@ export function buildQueueOptions(queue: CreateQueueOptions): InternalQueueOptio DuplicateDetectionHistoryTimeWindow: queue.duplicateDetectionHistoryTimeWindow, MaxDeliveryCount: getStringOrUndefined(queue.maxDeliveryCount), EnableBatchedOperations: getStringOrUndefined(queue.enableBatchedOperations), - - // TODO: found while syncing the ordering. This property is in .net, but not in ours? - //IsAnonymousAccessible: false, - AuthorizationRules: getRawAuthorizationRules(queue.authorizationRules), Status: getStringOrUndefined(queue.status), ForwardTo: getStringOrUndefined(queue.forwardTo), diff --git a/sdk/servicebus/service-bus/src/serializers/topicResourceSerializer.ts b/sdk/servicebus/service-bus/src/serializers/topicResourceSerializer.ts index 1c301d1633d8..3888ceae08e1 100644 --- a/sdk/servicebus/service-bus/src/serializers/topicResourceSerializer.ts +++ b/sdk/servicebus/service-bus/src/serializers/topicResourceSerializer.ts @@ -44,7 +44,6 @@ export function buildTopicOptions(topic: CreateTopicOptions): InternalTopicOptio DuplicateDetectionHistoryTimeWindow: topic.duplicateDetectionHistoryTimeWindow, EnableBatchedOperations: getStringOrUndefined(topic.enableBatchedOperations), // TODO: in .net, but not in here: FilteringMessagesBeforePublishing - // TODO: in .net, but not in here: IsAnonymousAccessible AuthorizationRules: getRawAuthorizationRules(topic.authorizationRules), Status: getStringOrUndefined(topic.status), // TODO: in .net, but not in here: ForwardTo From 16f082113107d12110791354aab53fc54e89dfaf Mon Sep 17 00:00:00 2001 From: Richard Park Date: Fri, 2 Apr 2021 16:16:24 -0700 Subject: [PATCH 04/13] Formatting --- .../src/serializers/queueResourceSerializer.ts | 8 ++++---- .../src/serializers/subscriptionResourceSerializer.ts | 4 ++-- .../src/serializers/topicResourceSerializer.ts | 4 ++-- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/sdk/servicebus/service-bus/src/serializers/queueResourceSerializer.ts b/sdk/servicebus/service-bus/src/serializers/queueResourceSerializer.ts index 6cfe0ce6ffdb..00d2e2e6dd73 100644 --- a/sdk/servicebus/service-bus/src/serializers/queueResourceSerializer.ts +++ b/sdk/servicebus/service-bus/src/serializers/queueResourceSerializer.ts @@ -33,8 +33,8 @@ export function buildQueueOptions(queue: CreateQueueOptions): InternalQueueOptio return { // NOTE: this ordering is extremely important. As an example, misordering of the ForwardTo property // resulted in a customer bug where the Forwarding attributes appeared to be set but the portal was - // not picking up on it. - // + // not picking up on it. + // // The authority on this ordering is here: // https://github.com/Azure/azure-sdk-for-net/blob/master/sdk/servicebus/Azure.Messaging.ServiceBus/src/Administration/QueuePropertiesExtensions.cs#L20 @@ -47,7 +47,7 @@ export function buildQueueOptions(queue: CreateQueueOptions): InternalQueueOptio DuplicateDetectionHistoryTimeWindow: queue.duplicateDetectionHistoryTimeWindow, MaxDeliveryCount: getStringOrUndefined(queue.maxDeliveryCount), EnableBatchedOperations: getStringOrUndefined(queue.enableBatchedOperations), - AuthorizationRules: getRawAuthorizationRules(queue.authorizationRules), + AuthorizationRules: getRawAuthorizationRules(queue.authorizationRules), Status: getStringOrUndefined(queue.status), ForwardTo: getStringOrUndefined(queue.forwardTo), UserMetadata: getStringOrUndefined(queue.userMetadata), @@ -57,7 +57,7 @@ export function buildQueueOptions(queue: CreateQueueOptions): InternalQueueOptio // TODO: can't find this in the .net ATOM library. EntityAvailabilityStatus: getStringOrUndefined(queue.availabilityStatus), - EnableExpress: getStringOrUndefined(queue.enableExpress), + EnableExpress: getStringOrUndefined(queue.enableExpress) }; } diff --git a/sdk/servicebus/service-bus/src/serializers/subscriptionResourceSerializer.ts b/sdk/servicebus/service-bus/src/serializers/subscriptionResourceSerializer.ts index d1592ae6ffab..e0c1304f8eca 100644 --- a/sdk/servicebus/service-bus/src/serializers/subscriptionResourceSerializer.ts +++ b/sdk/servicebus/service-bus/src/serializers/subscriptionResourceSerializer.ts @@ -38,8 +38,8 @@ export function buildSubscriptionOptions( return { // NOTE: this ordering is extremely important. As an example, misordering of the ForwardTo property // resulted in a customer bug where the Forwarding attributes appeared to be set but the portal was - // not picking up on it. - // + // not picking up on it. + // // The authority on this ordering is here: // https://github.com/Azure/azure-sdk-for-net/blob/master/sdk/servicebus/Azure.Messaging.ServiceBus/src/Administration/SubscriptionPropertiesExtensions.cs#L191 LockDuration: subscription.lockDuration, diff --git a/sdk/servicebus/service-bus/src/serializers/topicResourceSerializer.ts b/sdk/servicebus/service-bus/src/serializers/topicResourceSerializer.ts index 3888ceae08e1..35f060fdf70d 100644 --- a/sdk/servicebus/service-bus/src/serializers/topicResourceSerializer.ts +++ b/sdk/servicebus/service-bus/src/serializers/topicResourceSerializer.ts @@ -33,8 +33,8 @@ export function buildTopicOptions(topic: CreateTopicOptions): InternalTopicOptio return { // NOTE: this ordering is extremely important. As an example, misordering of the ForwardTo property // resulted in a customer bug where the Forwarding attributes appeared to be set but the portal was - // not picking up on it. - // + // not picking up on it. + // // The authority on this ordering is here: // https://github.com/Azure/azure-sdk-for-net/blob/master/sdk/servicebus/Azure.Messaging.ServiceBus/src/Administration/TopicPropertiesExtensions.cs#L175 From 0d400b2de4571a99396d4e8d639bc599f798b8db Mon Sep 17 00:00:00 2001 From: Richard Park Date: Fri, 2 Apr 2021 18:52:57 -0700 Subject: [PATCH 05/13] Forwarding is done at the subscription level --- .../serializers/topicResourceSerializer.ts | 1 - .../test/public/atomManagement.spec.ts | 37 ++++++++++++++++++- 2 files changed, 36 insertions(+), 2 deletions(-) diff --git a/sdk/servicebus/service-bus/src/serializers/topicResourceSerializer.ts b/sdk/servicebus/service-bus/src/serializers/topicResourceSerializer.ts index 35f060fdf70d..0548371501b4 100644 --- a/sdk/servicebus/service-bus/src/serializers/topicResourceSerializer.ts +++ b/sdk/servicebus/service-bus/src/serializers/topicResourceSerializer.ts @@ -46,7 +46,6 @@ export function buildTopicOptions(topic: CreateTopicOptions): InternalTopicOptio // TODO: in .net, but not in here: FilteringMessagesBeforePublishing AuthorizationRules: getRawAuthorizationRules(topic.authorizationRules), Status: getStringOrUndefined(topic.status), - // TODO: in .net, but not in here: ForwardTo UserMetadata: getStringOrUndefined(topic.userMetadata), SupportOrdering: getStringOrUndefined(topic.supportOrdering), AutoDeleteOnIdle: getStringOrUndefined(topic.autoDeleteOnIdle), diff --git a/sdk/servicebus/service-bus/test/public/atomManagement.spec.ts b/sdk/servicebus/service-bus/test/public/atomManagement.spec.ts index 168c9ef0dcfc..ab9a10860c9c 100644 --- a/sdk/servicebus/service-bus/test/public/atomManagement.spec.ts +++ b/sdk/servicebus/service-bus/test/public/atomManagement.spec.ts @@ -17,9 +17,10 @@ import { ServiceBusAdministrationClient, WithResponse } from "../../src"; import { EntityStatus, EntityAvailabilityStatus } from "../../src"; import { EnvVarNames, getEnvVars } from "./utils/envVarUtils"; import { recreateQueue, recreateSubscription, recreateTopic } from "./utils/managementUtils"; -import { EntityNames } from "./utils/testUtils"; +import { EntityNames, TestClientType } from "./utils/testUtils"; import { TestConstants } from "./testConstants"; import { AzureNamedKeyCredential } from "@azure/core-auth"; +import { createServiceBusClientForTests, ServiceBusClientForTests } from "./utils/testutils2"; chai.use(chaiAsPromised); chai.use(chaiExclude); @@ -60,6 +61,40 @@ const newManagementEntity2 = EntityNames.MANAGEMENT_NEW_ENTITY_2; type AccessRights = ("Manage" | "Send" | "Listen")[]; const randomDate = new Date(); +describe("Atom management - forwarding", () => { + let serviceBusClient: ServiceBusClientForTests; + + before(() => { + serviceBusClient = createServiceBusClientForTests(); + }); + + after(() => serviceBusClient.test.after()); + + afterEach(async () => { + serviceBusClient.test.afterEach(); + }); + + it.only("forwarding", async () => { + const willForward = await serviceBusClient.test.createTestEntities(TestClientType.PartitionedQueue); + const willBeForwardedTo = await serviceBusClient.test.createTestEntities(TestClientType.UnpartitionedQueue); + + // make it so all messages from `willForward` are forwarded to `willBeForwardedTo` + const queueProperties = await serviceBusAtomManagementClient.getQueue(willForward.queue!); + queueProperties.forwardTo = willBeForwardedTo.queue!; + await serviceBusAtomManagementClient.updateQueue(queueProperties); + + const receiver = await serviceBusClient.test.createReceiveAndDeleteReceiver(willBeForwardedTo); + const sender = await serviceBusClient.test.createSender(willForward); + + await sender.sendMessages({ + body: "forwarded message!" + }); + + const messages = await receiver.receiveMessages(1); + assert.deepEqual([{ body: "forwarded message!" }], messages.map(m => ({ body: m.body }))); + }); +}); + describe("Atom management - Namespace", function(): void { it("Get namespace properties", async () => { const namespaceProperties = await serviceBusAtomManagementClient.getNamespaceProperties(); From 2f731525efb2d21b157df9f13f243a0c8d1dae55 Mon Sep 17 00:00:00 2001 From: Richard Park Date: Fri, 2 Apr 2021 19:22:59 -0700 Subject: [PATCH 06/13] Adding in a test to make sure that forwarding works. --- .../test/public/atomManagement.spec.ts | 32 +++++++++++++++++-- 1 file changed, 29 insertions(+), 3 deletions(-) diff --git a/sdk/servicebus/service-bus/test/public/atomManagement.spec.ts b/sdk/servicebus/service-bus/test/public/atomManagement.spec.ts index ab9a10860c9c..c95c3161704d 100644 --- a/sdk/servicebus/service-bus/test/public/atomManagement.spec.ts +++ b/sdk/servicebus/service-bus/test/public/atomManagement.spec.ts @@ -61,6 +61,12 @@ const newManagementEntity2 = EntityNames.MANAGEMENT_NEW_ENTITY_2; type AccessRights = ("Manage" | "Send" | "Listen")[]; const randomDate = new Date(); +/** + * These tests are just a sanity check that our updates are actually + * _doing_ something. We've run into some bugs where we've done things like + * enabled forwarding only to find that forwarding isn't happening even though + * we can _read_ the attributes back. + */ describe("Atom management - forwarding", () => { let serviceBusClient: ServiceBusClientForTests; @@ -74,7 +80,7 @@ describe("Atom management - forwarding", () => { serviceBusClient.test.afterEach(); }); - it.only("forwarding", async () => { + it("queue: forwarding", async () => { const willForward = await serviceBusClient.test.createTestEntities(TestClientType.PartitionedQueue); const willBeForwardedTo = await serviceBusClient.test.createTestEntities(TestClientType.UnpartitionedQueue); @@ -87,11 +93,31 @@ describe("Atom management - forwarding", () => { const sender = await serviceBusClient.test.createSender(willForward); await sender.sendMessages({ - body: "forwarded message!" + body: "forwarded message with queues!" }); const messages = await receiver.receiveMessages(1); - assert.deepEqual([{ body: "forwarded message!" }], messages.map(m => ({ body: m.body }))); + assert.deepEqual([{ body: "forwarded message with queues!" }], messages.map(m => ({ body: m.body }))); + }); + + it("subscription: forwarding", async () => { + const willForward = await serviceBusClient.test.createTestEntities(TestClientType.PartitionedSubscription); + const willBeForwardedTo = await serviceBusClient.test.createTestEntities(TestClientType.UnpartitionedQueue); + + // make it so all messages from `willForward` are forwarded to `willBeForwardedTo` + const subscriptionProperties = await serviceBusAtomManagementClient.getSubscription(willForward.topic!, willForward.subscription!); + subscriptionProperties.forwardTo = willBeForwardedTo.queue!; + await serviceBusAtomManagementClient.updateSubscription(subscriptionProperties); + + const receiver = await serviceBusClient.test.createReceiveAndDeleteReceiver(willBeForwardedTo); + const sender = await serviceBusClient.test.createSender(willForward); + + await sender.sendMessages({ + body: "forwarded message with subscriptions!" + }); + + const messages = await receiver.receiveMessages(1); + assert.deepEqual([{ body: "forwarded message with subscriptions!" }], messages.map(m => ({ body: m.body }))); }); }); From 17fc87160c0c963d7af0db4e9ec54dffb21f696d Mon Sep 17 00:00:00 2001 From: Richard Park Date: Fri, 2 Apr 2021 19:23:26 -0700 Subject: [PATCH 07/13] Formatting --- .../test/public/atomManagement.spec.ts | 43 +++++++++++++------ 1 file changed, 30 insertions(+), 13 deletions(-) diff --git a/sdk/servicebus/service-bus/test/public/atomManagement.spec.ts b/sdk/servicebus/service-bus/test/public/atomManagement.spec.ts index c95c3161704d..76d5327ef3e1 100644 --- a/sdk/servicebus/service-bus/test/public/atomManagement.spec.ts +++ b/sdk/servicebus/service-bus/test/public/atomManagement.spec.ts @@ -81,8 +81,12 @@ describe("Atom management - forwarding", () => { }); it("queue: forwarding", async () => { - const willForward = await serviceBusClient.test.createTestEntities(TestClientType.PartitionedQueue); - const willBeForwardedTo = await serviceBusClient.test.createTestEntities(TestClientType.UnpartitionedQueue); + const willForward = await serviceBusClient.test.createTestEntities( + TestClientType.PartitionedQueue + ); + const willBeForwardedTo = await serviceBusClient.test.createTestEntities( + TestClientType.UnpartitionedQueue + ); // make it so all messages from `willForward` are forwarded to `willBeForwardedTo` const queueProperties = await serviceBusAtomManagementClient.getQueue(willForward.queue!); @@ -90,35 +94,48 @@ describe("Atom management - forwarding", () => { await serviceBusAtomManagementClient.updateQueue(queueProperties); const receiver = await serviceBusClient.test.createReceiveAndDeleteReceiver(willBeForwardedTo); - const sender = await serviceBusClient.test.createSender(willForward); - + const sender = await serviceBusClient.test.createSender(willForward); + await sender.sendMessages({ body: "forwarded message with queues!" }); const messages = await receiver.receiveMessages(1); - assert.deepEqual([{ body: "forwarded message with queues!" }], messages.map(m => ({ body: m.body }))); - }); + assert.deepEqual( + [{ body: "forwarded message with queues!" }], + messages.map((m) => ({ body: m.body })) + ); + }); it("subscription: forwarding", async () => { - const willForward = await serviceBusClient.test.createTestEntities(TestClientType.PartitionedSubscription); - const willBeForwardedTo = await serviceBusClient.test.createTestEntities(TestClientType.UnpartitionedQueue); + const willForward = await serviceBusClient.test.createTestEntities( + TestClientType.PartitionedSubscription + ); + const willBeForwardedTo = await serviceBusClient.test.createTestEntities( + TestClientType.UnpartitionedQueue + ); // make it so all messages from `willForward` are forwarded to `willBeForwardedTo` - const subscriptionProperties = await serviceBusAtomManagementClient.getSubscription(willForward.topic!, willForward.subscription!); + const subscriptionProperties = await serviceBusAtomManagementClient.getSubscription( + willForward.topic!, + willForward.subscription! + ); subscriptionProperties.forwardTo = willBeForwardedTo.queue!; await serviceBusAtomManagementClient.updateSubscription(subscriptionProperties); const receiver = await serviceBusClient.test.createReceiveAndDeleteReceiver(willBeForwardedTo); - const sender = await serviceBusClient.test.createSender(willForward); - + const sender = await serviceBusClient.test.createSender(willForward); + await sender.sendMessages({ body: "forwarded message with subscriptions!" }); const messages = await receiver.receiveMessages(1); - assert.deepEqual([{ body: "forwarded message with subscriptions!" }], messages.map(m => ({ body: m.body }))); - }); + assert.deepEqual( + [{ body: "forwarded message with subscriptions!" }], + messages.map((m) => ({ body: m.body })) + ); + }); }); describe("Atom management - Namespace", function(): void { From 79f2c285c7d90ced49d6243f4d5acab4339b9494 Mon Sep 17 00:00:00 2001 From: Richard Park Date: Fri, 2 Apr 2021 19:43:14 -0700 Subject: [PATCH 08/13] Use permalinks for the callbacks to the .net repo --- .../service-bus/src/serializers/queueResourceSerializer.ts | 2 +- .../src/serializers/subscriptionResourceSerializer.ts | 2 +- .../service-bus/src/serializers/topicResourceSerializer.ts | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/sdk/servicebus/service-bus/src/serializers/queueResourceSerializer.ts b/sdk/servicebus/service-bus/src/serializers/queueResourceSerializer.ts index 00d2e2e6dd73..a10e5757197b 100644 --- a/sdk/servicebus/service-bus/src/serializers/queueResourceSerializer.ts +++ b/sdk/servicebus/service-bus/src/serializers/queueResourceSerializer.ts @@ -36,7 +36,7 @@ export function buildQueueOptions(queue: CreateQueueOptions): InternalQueueOptio // not picking up on it. // // The authority on this ordering is here: - // https://github.com/Azure/azure-sdk-for-net/blob/master/sdk/servicebus/Azure.Messaging.ServiceBus/src/Administration/QueuePropertiesExtensions.cs#L20 + // https://github.com/Azure/azure-sdk-for-net/blob/8af2dfc32c96ef3e340f9d20013bf588d97ea756/sdk/servicebus/Azure.Messaging.ServiceBus/src/Administration/QueuePropertiesExtensions.cs#L20 LockDuration: queue.lockDuration, MaxSizeInMegabytes: getStringOrUndefined(queue.maxSizeInMegabytes), diff --git a/sdk/servicebus/service-bus/src/serializers/subscriptionResourceSerializer.ts b/sdk/servicebus/service-bus/src/serializers/subscriptionResourceSerializer.ts index e0c1304f8eca..67696fc4703b 100644 --- a/sdk/servicebus/service-bus/src/serializers/subscriptionResourceSerializer.ts +++ b/sdk/servicebus/service-bus/src/serializers/subscriptionResourceSerializer.ts @@ -41,7 +41,7 @@ export function buildSubscriptionOptions( // not picking up on it. // // The authority on this ordering is here: - // https://github.com/Azure/azure-sdk-for-net/blob/master/sdk/servicebus/Azure.Messaging.ServiceBus/src/Administration/SubscriptionPropertiesExtensions.cs#L191 + // https://github.com/Azure/azure-sdk-for-net/blob/8af2dfc32c96ef3e340f9d20013bf588d97ea756/sdk/servicebus/Azure.Messaging.ServiceBus/src/Administration/SubscriptionPropertiesExtensions.cs#L191 LockDuration: subscription.lockDuration, RequiresSession: getStringOrUndefined(subscription.requiresSession), DefaultMessageTimeToLive: getStringOrUndefined(subscription.defaultMessageTimeToLive), diff --git a/sdk/servicebus/service-bus/src/serializers/topicResourceSerializer.ts b/sdk/servicebus/service-bus/src/serializers/topicResourceSerializer.ts index 0548371501b4..63efc60dc517 100644 --- a/sdk/servicebus/service-bus/src/serializers/topicResourceSerializer.ts +++ b/sdk/servicebus/service-bus/src/serializers/topicResourceSerializer.ts @@ -36,7 +36,7 @@ export function buildTopicOptions(topic: CreateTopicOptions): InternalTopicOptio // not picking up on it. // // The authority on this ordering is here: - // https://github.com/Azure/azure-sdk-for-net/blob/master/sdk/servicebus/Azure.Messaging.ServiceBus/src/Administration/TopicPropertiesExtensions.cs#L175 + // https://github.com/Azure/azure-sdk-for-net/blob/8af2dfc32c96ef3e340f9d20013bf588d97ea756/sdk/servicebus/Azure.Messaging.ServiceBus/src/Administration/TopicPropertiesExtensions.cs#L175 DefaultMessageTimeToLive: topic.defaultMessageTimeToLive, MaxSizeInMegabytes: getStringOrUndefined(topic.maxSizeInMegabytes), From a64e67352d26ab488c8019c22c8b845b5cc21055 Mon Sep 17 00:00:00 2001 From: Richard Park Date: Fri, 2 Apr 2021 19:48:34 -0700 Subject: [PATCH 09/13] Remove comment, this field should be here (we're ahead, not behind!) --- .../src/serializers/subscriptionResourceSerializer.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/sdk/servicebus/service-bus/src/serializers/subscriptionResourceSerializer.ts b/sdk/servicebus/service-bus/src/serializers/subscriptionResourceSerializer.ts index 67696fc4703b..fa84808980eb 100644 --- a/sdk/servicebus/service-bus/src/serializers/subscriptionResourceSerializer.ts +++ b/sdk/servicebus/service-bus/src/serializers/subscriptionResourceSerializer.ts @@ -61,7 +61,6 @@ export function buildSubscriptionOptions( UserMetadata: getStringOrUndefined(subscription.userMetadata), ForwardDeadLetteredMessagesTo: getStringOrUndefined(subscription.forwardDeadLetteredMessagesTo), AutoDeleteOnIdle: getStringOrUndefined(subscription.autoDeleteOnIdle), - // TODO: EntityAvailabilityStatus does not exist in .net EntityAvailabilityStatus: getStringOrUndefined(subscription.availabilityStatus) }; } From 7add7dfb2387079c675c7bf1b6c08677adb6645f Mon Sep 17 00:00:00 2001 From: Ramya Rao Date: Mon, 5 Apr 2021 11:58:49 -0700 Subject: [PATCH 10/13] Remove TODO comments that do not have an action item --- .../service-bus/src/serializers/queueResourceSerializer.ts | 1 - .../service-bus/src/serializers/topicResourceSerializer.ts | 1 - 2 files changed, 2 deletions(-) diff --git a/sdk/servicebus/service-bus/src/serializers/queueResourceSerializer.ts b/sdk/servicebus/service-bus/src/serializers/queueResourceSerializer.ts index a10e5757197b..5fef085d56a4 100644 --- a/sdk/servicebus/service-bus/src/serializers/queueResourceSerializer.ts +++ b/sdk/servicebus/service-bus/src/serializers/queueResourceSerializer.ts @@ -55,7 +55,6 @@ export function buildQueueOptions(queue: CreateQueueOptions): InternalQueueOptio EnablePartitioning: getStringOrUndefined(queue.enablePartitioning), ForwardDeadLetteredMessagesTo: getStringOrUndefined(queue.forwardDeadLetteredMessagesTo), - // TODO: can't find this in the .net ATOM library. EntityAvailabilityStatus: getStringOrUndefined(queue.availabilityStatus), EnableExpress: getStringOrUndefined(queue.enableExpress) }; diff --git a/sdk/servicebus/service-bus/src/serializers/topicResourceSerializer.ts b/sdk/servicebus/service-bus/src/serializers/topicResourceSerializer.ts index 63efc60dc517..0a0b44ef7871 100644 --- a/sdk/servicebus/service-bus/src/serializers/topicResourceSerializer.ts +++ b/sdk/servicebus/service-bus/src/serializers/topicResourceSerializer.ts @@ -50,7 +50,6 @@ export function buildTopicOptions(topic: CreateTopicOptions): InternalTopicOptio SupportOrdering: getStringOrUndefined(topic.supportOrdering), AutoDeleteOnIdle: getStringOrUndefined(topic.autoDeleteOnIdle), EnablePartitioning: getStringOrUndefined(topic.enablePartitioning), - // TODO: in .net, but not in here: EnableSubscriptionPartitioning EntityAvailabilityStatus: getStringOrUndefined(topic.availabilityStatus), EnableExpress: getStringOrUndefined(topic.enableExpress) }; From e26d1619cf33fb519c8cd904386c82858ea100ee Mon Sep 17 00:00:00 2001 From: Ramya Rao Date: Mon, 5 Apr 2021 11:59:31 -0700 Subject: [PATCH 11/13] Remove empty line --- .../service-bus/src/serializers/queueResourceSerializer.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/sdk/servicebus/service-bus/src/serializers/queueResourceSerializer.ts b/sdk/servicebus/service-bus/src/serializers/queueResourceSerializer.ts index 5fef085d56a4..1f5397293b03 100644 --- a/sdk/servicebus/service-bus/src/serializers/queueResourceSerializer.ts +++ b/sdk/servicebus/service-bus/src/serializers/queueResourceSerializer.ts @@ -54,7 +54,6 @@ export function buildQueueOptions(queue: CreateQueueOptions): InternalQueueOptio AutoDeleteOnIdle: getStringOrUndefined(queue.autoDeleteOnIdle), EnablePartitioning: getStringOrUndefined(queue.enablePartitioning), ForwardDeadLetteredMessagesTo: getStringOrUndefined(queue.forwardDeadLetteredMessagesTo), - EntityAvailabilityStatus: getStringOrUndefined(queue.availabilityStatus), EnableExpress: getStringOrUndefined(queue.enableExpress) }; From 6bd76251c416ba27029e04a1fbe3d7ca533cf3d1 Mon Sep 17 00:00:00 2001 From: Harsha Nalluru Date: Mon, 5 Apr 2021 12:18:49 -0700 Subject: [PATCH 12/13] Update sdk/servicebus/service-bus/src/serializers/topicResourceSerializer.ts --- .../service-bus/src/serializers/topicResourceSerializer.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/sdk/servicebus/service-bus/src/serializers/topicResourceSerializer.ts b/sdk/servicebus/service-bus/src/serializers/topicResourceSerializer.ts index 0a0b44ef7871..339f844ee07d 100644 --- a/sdk/servicebus/service-bus/src/serializers/topicResourceSerializer.ts +++ b/sdk/servicebus/service-bus/src/serializers/topicResourceSerializer.ts @@ -43,7 +43,6 @@ export function buildTopicOptions(topic: CreateTopicOptions): InternalTopicOptio RequiresDuplicateDetection: getStringOrUndefined(topic.requiresDuplicateDetection), DuplicateDetectionHistoryTimeWindow: topic.duplicateDetectionHistoryTimeWindow, EnableBatchedOperations: getStringOrUndefined(topic.enableBatchedOperations), - // TODO: in .net, but not in here: FilteringMessagesBeforePublishing AuthorizationRules: getRawAuthorizationRules(topic.authorizationRules), Status: getStringOrUndefined(topic.status), UserMetadata: getStringOrUndefined(topic.userMetadata), From 608d6543b498353ac91430169acbf82f67ea5dcb Mon Sep 17 00:00:00 2001 From: HarshaNalluru Date: Mon, 5 Apr 2021 12:27:15 -0700 Subject: [PATCH 13/13] bug fix - changelog --- sdk/servicebus/service-bus/CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sdk/servicebus/service-bus/CHANGELOG.md b/sdk/servicebus/service-bus/CHANGELOG.md index 1a593c82a6a9..412d1559d4e4 100644 --- a/sdk/servicebus/service-bus/CHANGELOG.md +++ b/sdk/servicebus/service-bus/CHANGELOG.md @@ -6,6 +6,10 @@ These credential types support rotation via their `update` methods and are an alternative to using the `SharedAccessKeyName/SharedAccessKey` or `SharedAccessSignature` properties in a connection string. Resolves [#11891](https://github.com/Azure/azure-sdk-for-js/issues/11891). +### Bug fixes + +- Some of the queue properties such as "forwardTo" and "autoDeleteOnIdle" were not being set as requested through the `ServiceBusAdministrationClient.createQueue` method because of a bug w.r.t the ordering of XML properties. The issue has been fixed in [#14692](https://github.com/Azure/azure-sdk-for-js/pull/14692). + ## 7.0.4 (2021-03-31) ### Bug fixes