Servicebus remove viapartitionkey until Transactions are supported (#12026)
This commit is contained in:
Родитель
1ca73290d9
Коммит
aba7d47f9c
|
@ -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 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)
|
||||
|
||||
|
|
|
@ -358,7 +358,6 @@ export interface ServiceBusMessage {
|
|||
timeToLive?: number;
|
||||
to?: string;
|
||||
userId?: string;
|
||||
viaPartitionKey?: string;
|
||||
}
|
||||
|
||||
// @public
|
||||
|
|
|
@ -599,9 +599,11 @@ export class ManagementClient extends LinkEntity<RequestResponseLink> {
|
|||
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);
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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", () => {
|
||||
|
|
|
@ -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:
|
||||
|
|
Загрузка…
Ссылка в новой задаче