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

[Service Bus] Add workaround for scheduleMessage method in the docs #6983

Merged
4 changes: 4 additions & 0 deletions sdk/servicebus/service-bus/CHANGELOG.md
@@ -1,5 +1,9 @@
# Release History

## 1.1.3 (#Unreleased)

- Workaround for the [bug 6816](https://github.com/Azure/azure-sdk-for-js/issues/6816) affecting messages sent using the `scheduleMessage()` and `scheduleMessages()` methods has been added to the docs - [PR 6983](https://github.com/Azure/azure-sdk-for-js/pull/6983))

## 1.1.2 (2019-12-12)

- Updates `@azure/amqp-common` to version 1.0.0-preview.9.
Expand Down
42 changes: 42 additions & 0 deletions sdk/servicebus/service-bus/src/sender.ts
Expand Up @@ -108,6 +108,27 @@ export class Sender {
/**
* Schedules given message to appear on Service Bus Queue/Subscription at a later time.
*
* Recently, a bug has been surfaced with the `scheduleMessage()` method.
*
* More reference and details on the bug - https://github.com/Azure/azure-sdk-for-js/issues/6816#issuecomment-574461068
*
* You are affected with the bug in case you are depending on version < 2.0.0 of `@azure/service-bus`.
*
* Version 2.0.0 is not released yet and the fix for this bug will be shipped along with the release.
HarshaNalluru marked this conversation as resolved.
Show resolved Hide resolved
*
* Until then, please make use of the following workaround in order to leverage `scheduleMessage` functionality.
*
* Workaround
* 1. Import DefaultDataTransformer from "@azure/amqp-common" library.
HarshaNalluru marked this conversation as resolved.
Show resolved Hide resolved
* NPM Link - https://www.npmjs.com/package/@azure/amqp-common
* - In typescript, `import { DefaultDataTransformer } from "@azure/amqp-common";`
* - In javascript, `const { DefaultDataTransformer } = require("@azure/amqp-common");`
* 2. Update the message body before calling the scheduleMessage() method to send the message as follows
* - Instantiate the data transformer used by the sdk:
* `const dt = new DefaultDataTransformer();`
* - When you need to schedule the message, encode the message body before sending:
* `message.body = dt.encode(message.body);`
HarshaNalluru marked this conversation as resolved.
Show resolved Hide resolved
*
* @param scheduledEnqueueTimeUtc - The UTC time at which the message should be enqueued.
* @param message - The message that needs to be scheduled.
* @returns Promise<Long> - The sequence number of the message that was scheduled.
Expand Down Expand Up @@ -140,6 +161,27 @@ export class Sender {
/**
* Schedules given messages to appear on Service Bus Queue/Subscription at a later time.
*
* Recently, a bug has been surfaced with the `scheduleMessages()` method.
*
* More reference and details on the bug - https://github.com/Azure/azure-sdk-for-js/issues/6816#issuecomment-574461068
*
* You are affected with the bug in case you are depending on version < 2.0.0 of `@azure/service-bus`.
*
* Version 2.0.0 is not released yet and the fix for this bug will be shipped along with the release.
*
* Until then, please make use of the following workaround in order to leverage `scheduleMessages` functionality.
*
* Workaround
* 1. Import DefaultDataTransformer from "@azure/amqp-common" library.
* NPM Link - https://www.npmjs.com/package/@azure/amqp-common
* - In typescript, `import { DefaultDataTransformer } from "@azure/amqp-common";`
* - In javascript, `const { DefaultDataTransformer } = require("@azure/amqp-common");`
* 2. Update the message body before calling the scheduleMessages() method to send the message as follows
* - Instantiate the data transformer used by the sdk:
* `const dt = new DefaultDataTransformer();`
* - When you need to schedule the message, encode the message body before sending:
* `message.body = dt.encode(message.body);`
*
* @param scheduledEnqueueTimeUtc - The UTC time at which the messages should be enqueued.
* @param messages - Array of Messages that need to be scheduled.
* @returns Promise<Long[]> - The sequence numbers of messages that were scheduled.
Expand Down