Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Servicebus remove viapartitionkey #12026

Merged
1 change: 1 addition & 0 deletions sdk/servicebus/service-bus/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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<T>` 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.
mohsin-mehmood marked this conversation as resolved.
Show resolved Hide resolved

## 7.0.0-preview.7 (2020-10-07)

Expand Down
1 change: 0 additions & 1 deletion sdk/servicebus/service-bus/review/service-bus.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,6 @@ export interface ServiceBusMessage {
timeToLive?: number;
to?: string;
userId?: string;
viaPartitionKey?: string;
}

// @public
Expand Down
3 changes: 0 additions & 3 deletions sdk/servicebus/service-bus/src/core/managementClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -599,9 +599,6 @@ export class ManagementClient extends LinkEntity<RequestResponseLink> {
if (item.partitionKey) {
entry["partition-key"] = item.partitionKey;
}
if (item.viaPartitionKey) {
entry["via-partition-key"] = item.viaPartitionKey;
}
mohsin-mehmood marked this conversation as resolved.
Show resolved Hide resolved

const wrappedEntry = types.wrap_map(entry);
messageBody.push(wrappedEntry);
Expand Down
34 changes: 3 additions & 31 deletions sdk/servicebus/service-bus/src/serviceBusMessage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -140,15 +140,6 @@ export interface ServiceBusMessage {
*
*/
partitionKey?: string;
/**
* @property The partition key for sending a message into an entity
* via a partitioned transfer queue. Maximum length is 128 characters. If a message is sent via a
* transfer queue in the scope of a transaction, this value selects the transfer queue partition:
* This is functionally equivalent to `partitionKey` property and ensures that messages are kept
* 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;
/**
* @property The session identifier for a session-aware entity. Maximum
* length is 128 characters. For session-aware entities, this application-defined value specifies
Expand Down Expand Up @@ -466,14 +457,7 @@ 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;
}

if (msg.scheduledEnqueueTimeUtc != null) {
amqpMsg.message_annotations![Constants.scheduledEnqueueTime] = msg.scheduledEnqueueTimeUtc;
}
Expand Down Expand Up @@ -626,9 +610,7 @@ 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];
}

if (msg.message_annotations[Constants.scheduledEnqueueTime] != null) {
sbmsg.scheduledEnqueueTimeUtc = msg.message_annotations[Constants.scheduledEnqueueTime];
}
Expand Down Expand Up @@ -770,15 +752,6 @@ export class ServiceBusMessageImpl implements ServiceBusReceivedMessage {
* the `sessionId` property overrides this value.
*/
partitionKey?: string;
/**
* @property The partition key for sending a message into an entity
* via a partitioned transfer queue. Maximum length is 128 characters. If a message is sent via a
* transfer queue in the scope of a transaction, this value selects the transfer queue partition:
* This is functionally equivalent to `partitionKey` property and ensures that messages are kept
* 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;
/**
* @property The session identifier for a session-aware entity. Maximum
* length is 128 characters. For session-aware entities, this application-defined value specifies
Expand Down Expand Up @@ -1078,8 +1051,7 @@ export class ServiceBusMessageImpl implements ServiceBusReceivedMessage {
sessionId: this.sessionId,
timeToLive: this.timeToLive,
to: this.to,
applicationProperties: this.applicationProperties,
viaPartitionKey: this.viaPartitionKey
applicationProperties: this.applicationProperties
};

return clone;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ 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["random-msg-annotation-key"] = "random-msg-annotation-value";

const delivery_annotations: DeliveryAnnotations = {
Expand Down Expand Up @@ -135,11 +134,6 @@ describe("ServiceBusMessageImpl AmqpAnnotations unit tests", () => {
message_annotations[Constants.partitionKey],
"Unexpected Partition Key"
);
assert.equal(
sbMessage.viaPartitionKey,
message_annotations[Constants.viaPartitionKey],
"Unexpected Via Partition Key"
);
});

it("delivery annotations match", () => {
Expand Down
6 changes: 0 additions & 6 deletions sdk/servicebus/service-bus/test/sendAndSchedule.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -445,12 +445,6 @@ 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: "", sessionId: longString },
expectedErrorMessage:
Expand Down