Skip to content

Commit

Permalink
[Service Bus] Support MaxMessageSizeInKilobytes (#17953)
Browse files Browse the repository at this point in the history
* Fix retry handling for Session Not Found errors

* Update sdk/cosmosdb/cosmos/test/internal/session.spec.ts

Co-authored-by: Zachary Foster <[email protected]>

* Update CODEOWNERS for Application Insights (#17055)

* MaxMessageSizeInKilobytes api

* sample,test.env

* API Report

* add tests

* finish the tests

* remove console.log

* arm template

* put .only to test in CI with limited tests

* minor test update

* remove .only, add changelog

* Update sdk/servicebus/service-bus/src/util/constants.ts

Co-authored-by: chradek <[email protected]>

* wrap text - changelog

* maxMessageSizeInKilobytes: 256 by default for Standard namespaces

* Revert "maxMessageSizeInKilobytes: 256 by default for Standard namespaces"

This reverts commit 4f42563.

* exclude "maxMessageSizeInKilobytes"

* (Configurable only for Premium Tier Service Bus namespace.)

* Version 7.3.1-beta.1

* update version at more places

* lock file

* Update sdk/servicebus/service-bus/CHANGELOG.md

Co-authored-by: Adam Ling (MSFT) <[email protected]>

* lock file

* non optional in EntityProperties

* api report

Co-authored-by: Steve Faulkner <[email protected]>
Co-authored-by: Zachary Foster <[email protected]>
Co-authored-by: omziv <[email protected]>
Co-authored-by: chradek <[email protected]>
Co-authored-by: Adam Ling (MSFT) <[email protected]>
  • Loading branch information
6 people authored Oct 1, 2021
1 parent f5f8524 commit afff61b
Show file tree
Hide file tree
Showing 12 changed files with 2,694 additions and 2,416 deletions.
47 changes: 45 additions & 2 deletions common/config/rush/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion sdk/servicebus/service-bus/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
# Release History

## 7.3.1 (Unreleased)
## 7.3.1-beta.1 (Unreleased)

### Features Added

- Adds new get/set property `maxMessageSizeInKilobytes` to `QueueProperties`, `TopicProperties`, `CreateQueueOptions`, and `CreateTopicOptions`. Only applicable for premium namespaces. Use this when creating or updating queues and topics. Added in [#17953](https://github.com/Azure/azure-sdk-for-js/pull/17953)

### Breaking Changes

### Bugs Fixed
Expand Down
2 changes: 1 addition & 1 deletion sdk/servicebus/service-bus/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "@azure/service-bus",
"sdk-type": "client",
"author": "Microsoft Corporation",
"version": "7.3.1",
"version": "7.3.1-beta.1",
"license": "MIT",
"description": "Azure Service Bus SDK for JavaScript",
"homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/servicebus/service-bus/",
Expand Down
4 changes: 4 additions & 0 deletions sdk/servicebus/service-bus/review/service-bus.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ export interface CreateQueueOptions extends OperationOptions {
forwardTo?: string;
lockDuration?: string;
maxDeliveryCount?: number;
maxMessageSizeInKilobytes?: number;
maxSizeInMegabytes?: number;
requiresDuplicateDetection?: boolean;
requiresSession?: boolean;
Expand Down Expand Up @@ -113,6 +114,7 @@ export interface CreateTopicOptions extends OperationOptions {
enableBatchedOperations?: boolean;
enableExpress?: boolean;
enablePartitioning?: boolean;
maxMessageSizeInKilobytes?: number;
maxSizeInMegabytes?: number;
requiresDuplicateDetection?: boolean;
status?: EntityStatus;
Expand Down Expand Up @@ -199,6 +201,7 @@ export interface QueueProperties {
forwardTo?: string;
lockDuration: string;
maxDeliveryCount: number;
maxMessageSizeInKilobytes: number;
maxSizeInMegabytes: number;
readonly name: string;
readonly requiresDuplicateDetection: boolean;
Expand Down Expand Up @@ -551,6 +554,7 @@ export interface TopicProperties {
enableBatchedOperations: boolean;
readonly enableExpress: boolean;
readonly enablePartitioning: boolean;
maxMessageSizeInKilobytes: number;
maxSizeInMegabytes: number;
readonly name: string;
readonly requiresDuplicateDetection: boolean;
Expand Down
4 changes: 2 additions & 2 deletions sdk/servicebus/service-bus/sample.env
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Used in most samples. Retrieve these values from a storage account in the Azure Portal.
# Used in most samples. Retrieve these values from a service-bus namespace in the Azure Portal.
SERVICEBUS_ENDPOINT="<service bus namespace>.servicebus.windows.net"
SERVICEBUS_CONNECTION_STRING="<connection string>"

Expand All @@ -23,4 +23,4 @@ AZURE_CLIENT_ID=<ID of the user/service principal to authenticate as>
AZURE_CLIENT_SECRET=<client secret used to authenticate to Azure AD>

# To run the useProxy sample, set up an HTTP proxy and enter your information:
# HTTP_PROXY=http://localhost:3128
# HTTP_PROXY=http://localhost:3128
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@ export function buildQueueOptions(queue: CreateQueueOptions): InternalQueueOptio
EnablePartitioning: getStringOrUndefined(queue.enablePartitioning),
ForwardDeadLetteredMessagesTo: getStringOrUndefined(queue.forwardDeadLetteredMessagesTo),
EntityAvailabilityStatus: getStringOrUndefined(queue.availabilityStatus),
EnableExpress: getStringOrUndefined(queue.enableExpress)
EnableExpress: getStringOrUndefined(queue.enableExpress),
MaxMessageSizeInKilobytes: getStringOrUndefined(queue.maxMessageSizeInKilobytes)
};
}

Expand Down Expand Up @@ -111,7 +112,12 @@ export function buildQueue(rawQueue: Record<string, any>): QueueProperties {

enableExpress: getBoolean(rawQueue[Constants.ENABLE_EXPRESS], "enableExpress"),

availabilityStatus: rawQueue[Constants.ENTITY_AVAILABILITY_STATUS]
availabilityStatus: rawQueue[Constants.ENTITY_AVAILABILITY_STATUS],

maxMessageSizeInKilobytes: getInteger(
rawQueue[Constants.MAX_MESSAGE_SIZE_IN_KILOBYTES],
"maxMessageSizeInKilobytes"
)
};
}

Expand Down Expand Up @@ -156,6 +162,13 @@ export interface CreateQueueOptions extends OperationOptions {
*/
maxSizeInMegabytes?: number;

/**
* The maximum message size in kilobytes for messages sent to this queue.
*
* (Configurable only for Premium Tier Service Bus namespace.)
*/
maxMessageSizeInKilobytes?: number;

/**
* If enabled, the topic will detect duplicate messages within the time
* span specified by the DuplicateDetectionHistoryTimeWindow property.
Expand Down Expand Up @@ -299,6 +312,11 @@ export interface QueueProperties {
*/
maxSizeInMegabytes: number;

/**
* The maximum message size in kilobytes for messages sent to this queue.
*/
maxMessageSizeInKilobytes: number;

/**
* If enabled, the topic will detect duplicate messages within the time
* span specified by the DuplicateDetectionHistoryTimeWindow property.
Expand Down Expand Up @@ -436,6 +454,11 @@ export interface InternalQueueOptions {
*/
MaxSizeInMegabytes?: string;

/**
* The maximum message size in kilobytes for messages sent to this queue/topic.
*/
MaxMessageSizeInKilobytes?: string;

/**
* If enabled, the topic will detect duplicate messages within the time
* span specified by the DuplicateDetectionHistoryTimeWindow property.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ export function buildTopicOptions(topic: CreateTopicOptions): InternalTopicOptio
AutoDeleteOnIdle: getStringOrUndefined(topic.autoDeleteOnIdle),
EnablePartitioning: getStringOrUndefined(topic.enablePartitioning),
EntityAvailabilityStatus: getStringOrUndefined(topic.availabilityStatus),
EnableExpress: getStringOrUndefined(topic.enableExpress)
EnableExpress: getStringOrUndefined(topic.enableExpress),
MaxMessageSizeInKilobytes: getStringOrUndefined(topic.maxMessageSizeInKilobytes)
};
}

Expand Down Expand Up @@ -93,7 +94,12 @@ export function buildTopic(rawTopic: Record<string, any>): TopicProperties {

enableExpress: getBoolean(rawTopic[Constants.ENABLE_EXPRESS], "enableExpress"),

availabilityStatus: rawTopic[Constants.ENTITY_AVAILABILITY_STATUS]
availabilityStatus: rawTopic[Constants.ENTITY_AVAILABILITY_STATUS],

maxMessageSizeInKilobytes: getInteger(
rawTopic[Constants.MAX_MESSAGE_SIZE_IN_KILOBYTES],
"maxMessageSizeInKilobytes"
)
};
}

Expand Down Expand Up @@ -142,6 +148,13 @@ export interface CreateTopicOptions extends OperationOptions {
*/
maxSizeInMegabytes?: number;

/**
* The maximum message size in kilobytes for messages sent to this topic.
*
* (Configurable only for Premium Tier Service Bus namespace.)
*/
maxMessageSizeInKilobytes?: number;

/**
* If enabled, the topic will detect duplicate messages within the time span
* specified by the DuplicateDetectionHistoryTimeWindow property.
Expand Down Expand Up @@ -243,6 +256,11 @@ export interface TopicProperties {
*/
maxSizeInMegabytes: number;

/**
* The maximum message size in kilobytes for messages sent to this queue/topic.
*/
maxMessageSizeInKilobytes: number;

/**
* If enabled, the topic will detect duplicate messages within the time span
* specified by the DuplicateDetectionHistoryTimeWindow property.
Expand Down Expand Up @@ -339,6 +357,12 @@ export interface InternalTopicOptions {
*/
MaxSizeInMegabytes?: string;

/**
* The maximum message size in kilobytes for messages sent to this queue/topic
*
*/
MaxMessageSizeInKilobytes?: string;

/**
* If enabled, the topic will detect duplicate messages within the time span
* specified by the DuplicateDetectionHistoryTimeWindow property.
Expand Down
11 changes: 8 additions & 3 deletions sdk/servicebus/service-bus/src/util/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/
export const packageJsonInfo = {
name: "@azure/service-bus",
version: "7.3.1"
version: "7.3.1-beta.1"
};

/**
Expand Down Expand Up @@ -172,7 +172,12 @@ export const USER_METADATA = "UserMetadata";
* @internal
*/
export const MAX_SIZE_IN_MEGABYTES = "MaxSizeInMegabytes";

/**
* The maximum size in kilobytes.
*
* @internal
*/
export const MAX_MESSAGE_SIZE_IN_KILOBYTES = "MaxMessageSizeInKilobytes";
/**
* The default message time to live.
* This is specified in ISO-8601 duration format such as "PT1M" for 1 minute, "PT5S" for 5 seconds.
Expand Down Expand Up @@ -273,7 +278,7 @@ export const API_VERSION_QUERY_KEY = "api-version";
*
* @internal
*/
export const CURRENT_API_VERSION = "2017-04";
export const CURRENT_API_VERSION = "2021-05";

/**
* Constant representing the Odata Error 'message' property
Expand Down
10 changes: 10 additions & 0 deletions sdk/servicebus/service-bus/test.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Used in most tests. Retrieve this value from a service-bus namespace in the Azure Portal.
SERVICEBUS_CONNECTION_STRING="<connection string>"

# Used in a couple of tests
SERVICEBUS_CONNECTION_STRING_PREMIUM="<connection string>"

# Used to authenticate using Azure AD as a service principal for role-based authentication.
AZURE_TENANT_ID=<AD tenant id or name>
AZURE_CLIENT_ID=<ID of the user/service principal to authenticate as>
AZURE_CLIENT_SECRET=<client secret used to authenticate to Azure AD>
Loading

0 comments on commit afff61b

Please sign in to comment.