diff --git a/sdk/servicebus/service-bus/CHANGELOG.md b/sdk/servicebus/service-bus/CHANGELOG.md index 364ed286e2a7..b766dda7e685 100644 --- a/sdk/servicebus/service-bus/CHANGELOG.md +++ b/sdk/servicebus/service-bus/CHANGELOG.md @@ -39,6 +39,7 @@ - `ServiceBusSender.scheduleMessages` method signature updated: `scheduledEnqueueTimeUtc` and `messages` parameters are swapped. - Interfaces corresponding to the returned responses from the methods under the `ServiceBusAdministrationClient` such as `NamespacePropertiesResponse`, `QueueResponse`, `TopicRuntimePropertiesResponse` have been removed in favor of using generic type `WithResponse` for a cleaner API surface. [PR 10491](https://github.com/Azure/azure-sdk-for-js/pull/10491) +- `viaPartitionKey` property of interface `ServiceMessageBus` has been removed until we implement the [Transactions feature of Service Bus](https://docs.microsoft.com/azure/service-bus-messaging/service-bus-transactions). ## 7.0.0-preview.7 (2020-10-07) diff --git a/sdk/servicebus/service-bus/review/service-bus.api.md b/sdk/servicebus/service-bus/review/service-bus.api.md index 2c83fd8ef174..165925f893d0 100644 --- a/sdk/servicebus/service-bus/review/service-bus.api.md +++ b/sdk/servicebus/service-bus/review/service-bus.api.md @@ -358,7 +358,6 @@ export interface ServiceBusMessage { timeToLive?: number; to?: string; userId?: string; - viaPartitionKey?: string; } // @public diff --git a/sdk/servicebus/service-bus/src/core/managementClient.ts b/sdk/servicebus/service-bus/src/core/managementClient.ts index 570835373d2a..04f4089ba548 100644 --- a/sdk/servicebus/service-bus/src/core/managementClient.ts +++ b/sdk/servicebus/service-bus/src/core/managementClient.ts @@ -599,9 +599,11 @@ export class ManagementClient extends LinkEntity { if (item.partitionKey) { entry["partition-key"] = item.partitionKey; } - if (item.viaPartitionKey) { - entry["via-partition-key"] = item.viaPartitionKey; - } + + // Will be required later for implementing Transactions + // if (item.viaPartitionKey) { + // entry["via-partition-key"] = item.viaPartitionKey; + // } const wrappedEntry = types.wrap_map(entry); messageBody.push(wrappedEntry); diff --git a/sdk/servicebus/service-bus/src/serviceBusMessage.ts b/sdk/servicebus/service-bus/src/serviceBusMessage.ts index 291dc4c9c499..5755bbb971a0 100644 --- a/sdk/servicebus/service-bus/src/serviceBusMessage.ts +++ b/sdk/servicebus/service-bus/src/serviceBusMessage.ts @@ -148,7 +148,10 @@ export interface ServiceBusMessage { * together and in order as they are transferred. * See {@link https://docs.microsoft.com/azure/service-bus-messaging/service-bus-transactions#transfers-and-send-via Transfers and Send Via}. */ - viaPartitionKey?: string; + + // Will be required later for implementing Transactions + // viaPartitionKey?: string; + /** * @property The session identifier for a session-aware entity. Maximum * length is 128 characters. For session-aware entities, this application-defined value specifies @@ -466,14 +469,17 @@ export function toAmqpMessage(msg: ServiceBusMessage): AmqpMessage { } amqpMsg.message_annotations![Constants.partitionKey] = msg.partitionKey; } - if (msg.viaPartitionKey != null) { - if (msg.viaPartitionKey.length > Constants.maxPartitionKeyLength) { - throw new Error( - "Length of 'viaPartitionKey' property on the message cannot be greater than 128 characters." - ); - } - amqpMsg.message_annotations![Constants.viaPartitionKey] = msg.viaPartitionKey; - } + + // Will be required later for implementing Transactions + // if (msg.viaPartitionKey != null) { + // if (msg.viaPartitionKey.length > Constants.maxPartitionKeyLength) { + // throw new Error( + // "Length of 'viaPartitionKey' property on the message cannot be greater than 128 characters." + // ); + // } + // amqpMsg.message_annotations![Constants.viaPartitionKey] = msg.viaPartitionKey; + // } + if (msg.scheduledEnqueueTimeUtc != null) { amqpMsg.message_annotations![Constants.scheduledEnqueueTime] = msg.scheduledEnqueueTimeUtc; } @@ -626,9 +632,12 @@ export function fromAmqpMessage( if (msg.message_annotations[Constants.partitionKey] != null) { sbmsg.partitionKey = msg.message_annotations[Constants.partitionKey]; } - if (msg.message_annotations[Constants.viaPartitionKey] != null) { - sbmsg.viaPartitionKey = msg.message_annotations[Constants.viaPartitionKey]; - } + + // Will be required later for implementing Transactions + // if (msg.message_annotations[Constants.viaPartitionKey] != null) { + // sbmsg.viaPartitionKey = msg.message_annotations[Constants.viaPartitionKey]; + // } + if (msg.message_annotations[Constants.scheduledEnqueueTime] != null) { sbmsg.scheduledEnqueueTimeUtc = msg.message_annotations[Constants.scheduledEnqueueTime]; } @@ -778,7 +787,8 @@ export class ServiceBusMessageImpl implements ServiceBusReceivedMessage { * together and in order as they are transferred. * See {@link https://docs.microsoft.com/azure/service-bus-messaging/service-bus-transactions#transfers-and-send-via Transfers and Send Via}. */ - viaPartitionKey?: string; + // Will be required later for implementing Transactions + // viaPartitionKey?: string; /** * @property The session identifier for a session-aware entity. Maximum * length is 128 characters. For session-aware entities, this application-defined value specifies @@ -1078,8 +1088,9 @@ export class ServiceBusMessageImpl implements ServiceBusReceivedMessage { sessionId: this.sessionId, timeToLive: this.timeToLive, to: this.to, - applicationProperties: this.applicationProperties, - viaPartitionKey: this.viaPartitionKey + applicationProperties: this.applicationProperties + // Will be required later for implementing Transactions + // viaPartitionKey: this.viaPartitionKey }; return clone; diff --git a/sdk/servicebus/service-bus/test/internal/serviceBusMessage.spec.ts b/sdk/servicebus/service-bus/test/internal/serviceBusMessage.spec.ts index 58e8104db8fb..5786f8613b7e 100644 --- a/sdk/servicebus/service-bus/test/internal/serviceBusMessage.spec.ts +++ b/sdk/servicebus/service-bus/test/internal/serviceBusMessage.spec.ts @@ -62,7 +62,7 @@ describe("ServiceBusMessageImpl AmqpAnnotations unit tests", () => { const message_annotations: MessageAnnotations = {}; message_annotations[Constants.enqueuedTime] = Date.now(); message_annotations[Constants.partitionKey] = "dummy-partition-key"; - message_annotations[Constants.viaPartitionKey] = "dummy-via-partition-key"; + //message_annotations[Constants.viaPartitionKey] = "dummy-via-partition-key"; message_annotations["random-msg-annotation-key"] = "random-msg-annotation-value"; const delivery_annotations: DeliveryAnnotations = { @@ -135,11 +135,12 @@ describe("ServiceBusMessageImpl AmqpAnnotations unit tests", () => { message_annotations[Constants.partitionKey], "Unexpected Partition Key" ); - assert.equal( - sbMessage.viaPartitionKey, - message_annotations[Constants.viaPartitionKey], - "Unexpected Via Partition Key" - ); + + // assert.equal( + // sbMessage.viaPartitionKey, + // message_annotations[Constants.viaPartitionKey], + // "Unexpected Via Partition Key" + // ); }); it("delivery annotations match", () => { diff --git a/sdk/servicebus/service-bus/test/sendAndSchedule.spec.ts b/sdk/servicebus/service-bus/test/sendAndSchedule.spec.ts index e8b7a68adde5..605d5bc5c7b8 100644 --- a/sdk/servicebus/service-bus/test/sendAndSchedule.spec.ts +++ b/sdk/servicebus/service-bus/test/sendAndSchedule.spec.ts @@ -445,12 +445,12 @@ describe("ServiceBusMessage validations", function(): void { "Length of 'partitionKey' property on the message cannot be greater than 128 characters.", title: "partitionKey is longer than 128 characters" }, - { - message: { body: "", viaPartitionKey: longString }, - expectedErrorMessage: - "Length of 'viaPartitionKey' property on the message cannot be greater than 128 characters.", - title: "viaPartitionKey is longer than 128 characters" - }, + // { + // message: { body: "", viaPartitionKey: longString }, + // expectedErrorMessage: + // "Length of 'viaPartitionKey' property on the message cannot be greater than 128 characters.", + // title: "viaPartitionKey is longer than 128 characters" + // }, { message: { body: "", sessionId: longString }, expectedErrorMessage: