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] Merge feature/service-bus-track-2 into master #7312

Merged
merged 26 commits into from
Feb 12, 2020
Merged
Show file tree
Hide file tree
Changes from 18 commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
7ba4432
Pin core-amqp version to preview.1
ramya-rao-a Jul 22, 2019
79bd77b
Merge remote-tracking branch 'origin/master' into feature/service-bus…
ramya-rao-a Aug 21, 2019
3598296
Merge remote-tracking branch 'origin/master' into feature/service-bus…
ramya-rao-a Sep 13, 2019
1708b42
Update lock file
ramya-rao-a Sep 13, 2019
8b8f422
Fix merge conflicts
ramya-rao-a Sep 13, 2019
0c584b5
[Service Bus] Update to use core-amqp (#5324)
ramya0820 Jan 2, 2020
b6687e2
Merge remote-tracking branch 'origin/master' into feature/service-bus…
ramya-rao-a Jan 3, 2020
2b18d0f
Use core-amqp in atom management client, comment tests that use token…
ramya-rao-a Jan 3, 2020
7630056
Merge remote-tracking branch 'origin/master' into feature/service-bus…
ramya-rao-a Jan 8, 2020
1cc899e
Merge remote-tracking branch 'origin/master' into feature/service-bus…
ramya-rao-a Jan 14, 2020
d5a4da5
Merge remote-tracking branch 'origin/master' into feature/service-bus…
ramya-rao-a Jan 14, 2020
b04922a
[Service Bus] Update to use latest core-amqp (#6861)
ramya0820 Jan 15, 2020
6947606
[Service Bus] Update constructors to add overloads and use Azure Iden…
ramya0820 Jan 15, 2020
1f33e84
Merge remote-tracking branch 'origin/master' into feature/service-bus…
ramya-rao-a Jan 15, 2020
6f59691
Merge remote-tracking branch 'upstream/feature/service-bus-track-2' i…
HarshaNalluru Feb 10, 2020
64d9e59
sync-versions: rhea-promise and @azure/core-amqp for service-bus
HarshaNalluru Feb 10, 2020
f4dd7ed
resolve merge conflicts appropriately
HarshaNalluru Feb 10, 2020
8431d03
API Report File for "@azure/service-bus"
HarshaNalluru Feb 10, 2020
069d65c
Merge branch 'master' of https://github.com/Azure/azure-sdk-for-js in…
HarshaNalluru Feb 11, 2020
3106eb1
Address feedback
HarshaNalluru Feb 11, 2020
d52c703
SERVICEBUS_CONNECTION_STRING_BROWSER remove from karma.conf
HarshaNalluru Feb 11, 2020
8afa665
Merge branch 'master' of https://github.com/Azure/azure-sdk-for-js in…
HarshaNalluru Feb 11, 2020
8896002
update pnpm-lock file
HarshaNalluru Feb 11, 2020
d193227
update API Report File for "@azure/service-bus"
HarshaNalluru Feb 11, 2020
a3dd240
remove rhea and rhea-promise dependencies
HarshaNalluru Feb 11, 2020
8c72d78
add "rhea-promise" back
HarshaNalluru Feb 11, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions common/config/rush/common-versions.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,6 @@
// "typescript": [
// "~2.4.0"
// ]
// Following is required to allow for backward compatibility with Service Bus Track 1
// TODO: Remove this once Service Bus is updated to use current depenedencies as part of Track 2
"rhea-promise": ["^0.1.15"],
// Following is required to allow for backward compatibility with Event Processor Host Track 1
"@azure/event-hubs": ["^2.1.4"]
}
Expand Down
7 changes: 4 additions & 3 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: 2 additions & 2 deletions sdk/servicebus/service-bus/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -211,13 +211,13 @@ export DEBUG=azure*,rhea*
- If you are **not interested in viewing the message transformation** (which consumes lot of console/disk space) then you can set the `DEBUG` environment variable as follows:

```bash
export DEBUG=azure*,rhea*,-rhea:raw,-rhea:message,-azure:amqp-common:datatransformer
export DEBUG=azure*,rhea*,-rhea:raw,-rhea:message,-azure:core-amqp:datatransformer
```

- If you are interested only in **errors**, then you can set the `DEBUG` environment variable as follows:

```bash
export DEBUG=azure:service-bus:error,azure-amqp-common:error,rhea-promise:error,rhea:events,rhea:frames,rhea:io,rhea:flow
export DEBUG=azure:service-bus:error,azure-core-amqp:error,rhea-promise:error,rhea:events,rhea:frames,rhea:io,rhea:flow
```

### Logging to a file
Expand Down
7 changes: 4 additions & 3 deletions sdk/servicebus/service-bus/karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,10 @@ module.exports = function(config) {
// https://www.npmjs.com/package/karma-env-preprocessor
envPreprocessor: [
"SERVICEBUS_CONNECTION_STRING",
"AAD_CLIENT_ID",
"AAD_CLIENT_SECRET",
"AAD_TENANT_ID"
"SERVICEBUS_CONNECTION_STRING_BROWSER",
HarshaNalluru marked this conversation as resolved.
Show resolved Hide resolved
"AZURE_CLIENT_ID",
"AZURE_CLIENT_SECRET",
"AZURE_TENANT_ID"
],

// test results reporter to use
Expand Down
9 changes: 4 additions & 5 deletions 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": "1.1.2",
"version": "2.0.0-preview.1",
"license": "MIT",
"description": "Azure Service Bus SDK for Node.js",
"homepage": "https://github.com/Azure/azure-sdk-for-js/tree/master/sdk/servicebus/service-bus",
Expand All @@ -20,7 +20,6 @@
"module": "dist-esm/src/index.js",
"browser": {
"./dist/index.js": "./browser/service-bus.js",
"./dist-esm/test/utils/aadUtils.js": "./dist-esm/test/utils/aadUtils.browser.js",
"./dist-esm/src/util/crypto.js": "./dist-esm/src/util/crypto.browser.js",
"./dist-esm/src/util/parseUrl.js": "./dist-esm/src/util/parseUrl.browser.js",
"buffer": "buffer",
Expand Down Expand Up @@ -78,9 +77,9 @@
]
},
"dependencies": {
"@azure/amqp-common": "1.0.0-preview.9",
"@azure/core-amqp": "^1.0.1",
"@azure/core-http": "^1.0.0",
"@azure/ms-rest-nodeauth": "^0.9.2",
"@azure/identity": "^1.0.0",
HarshaNalluru marked this conversation as resolved.
Show resolved Hide resolved
"@opentelemetry/types": "^0.2.0",
"@types/is-buffer": "^2.0.0",
"@types/long": "^4.0.0",
Expand All @@ -90,7 +89,7 @@
"long": "^4.0.0",
"process": "^0.11.10",
"rhea": "^1.0.18",
"rhea-promise": "^0.1.15",
"rhea-promise": "^1.0.0",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This and rhea shouldn't be needed anymore. core-amqp pulls them in.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed rhea and rhea-promise.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, I didn't realize rhea-promise was being used directly. It looks like only rhea can be safely removed.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added "rhea-promise" back

"tslib": "^1.10.0"
},
"devDependencies": {
Expand Down
31 changes: 13 additions & 18 deletions sdk/servicebus/service-bus/review/service-bus.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,19 @@

```ts

import { AmqpMessage } from '@azure/amqp-common';
import { ApplicationTokenCredentials } from '@azure/ms-rest-nodeauth';
import { DataTransformer } from '@azure/amqp-common';
import { DefaultDataTransformer } from '@azure/amqp-common';
import { delay } from '@azure/amqp-common';
import { AmqpMessage } from '@azure/core-amqp';
import { DataTransformer } from '@azure/core-amqp';
import { DefaultDataTransformer } from '@azure/core-amqp';
import { delay } from '@azure/core-amqp';
import { Delivery } from 'rhea-promise';
import { DeviceTokenCredentials } from '@azure/ms-rest-nodeauth';
import { HttpOperationResponse } from '@azure/core-http';
import Long from 'long';
import { MessagingError } from '@azure/amqp-common';
import { MSITokenCredentials } from '@azure/ms-rest-nodeauth';
import { MessagingError } from '@azure/core-amqp';
import { ProxySettings } from '@azure/core-http';
import { RetryOptions } from '@azure/core-amqp';
import { ServiceClient } from '@azure/core-http';
import { TokenInfo } from '@azure/amqp-common';
import { TokenProvider } from '@azure/amqp-common';
import { TokenType } from '@azure/amqp-common';
import { UserTokenCredentials } from '@azure/ms-rest-nodeauth';
import { TokenCredential } from '@azure/core-amqp';
import { TokenType } from '@azure/core-amqp';
import { WebSocketImpl } from 'rhea-promise';

// @public
Expand Down Expand Up @@ -285,6 +281,8 @@ export class Receiver {
renewMessageLock(lockTokenOrMessage: string | ServiceBusMessage): Promise<Date>;
}

export { RetryOptions }

// @public
export interface RuleDescription {
action?: string;
Expand Down Expand Up @@ -377,10 +375,9 @@ export interface ServiceBusAtomManagementClientOptions {

// @public
export class ServiceBusClient {
constructor(connectionString: string, options?: ServiceBusClientOptions);
constructor(host: string, credential: TokenCredential, options?: ServiceBusClientOptions);
close(): Promise<any>;
static createFromAadTokenCredentials(host: string, credentials: ApplicationTokenCredentials | UserTokenCredentials | DeviceTokenCredentials | MSITokenCredentials, options?: ServiceBusClientOptions): ServiceBusClient;
static createFromConnectionString(connectionString: string, options?: ServiceBusClientOptions): ServiceBusClient;
static createFromTokenProvider(host: string, tokenProvider: TokenProvider, options?: ServiceBusClientOptions): ServiceBusClient;
createQueueClient(queueName: string): QueueClient;
createSubscriptionClient(topicName: string, subscriptionName: string): SubscriptionClient;
createTopicClient(topicName: string): TopicClient;
Expand Down Expand Up @@ -552,9 +549,7 @@ export interface SubscriptionResponse extends SubscriptionDetails {
_response: HttpOperationResponse;
}

export { TokenInfo }

export { TokenProvider }
export { TokenCredential }

export { TokenType }

Expand Down
8 changes: 5 additions & 3 deletions sdk/servicebus/service-bus/src/clientEntityContext.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,12 @@ import { ConcurrentExpiringMap } from "./util/concurrentExpiringMap";
import { MessageReceiver } from "./core/messageReceiver";
import { MessageSession } from "./session/messageSession";
import { SessionManager } from "./session/sessionManager";
import { MessagingError } from "@azure/core-amqp";

/**
* @interface ClientEntityContext
* Provides contextual information like the underlying amqp connection, cbs session,
* management session, tokenProvider, senders, receivers, etc. about the ServiceBus client.
* management session, tokenCredential, senders, receivers, etc. about the ServiceBus client.
* @internal
*/
export interface ClientEntityContextBase {
Expand Down Expand Up @@ -148,10 +149,11 @@ export namespace ClientEntityContext {

(entityContext as ClientEntityContext).getReceiver = (name: string, sessionId?: string) => {
if (sessionId != undefined && entityContext.expiredMessageSessions[sessionId]) {
const error = new Error(
const error = new MessagingError(
`The session lock has expired on the session with id ${sessionId}.`
);
error.name = "SessionLockLostError";
error.code = "SessionLockLostError";
error.retryable = false;
log.error(
"[%s] Failed to find receiver '%s' as the session with id '%s' is expired",
entityContext.namespace.connectionId,
Expand Down
11 changes: 6 additions & 5 deletions sdk/servicebus/service-bus/src/connectionContext.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@ import {
CreateConnectionContextBaseParameters,
Dictionary,
delay,
TokenProvider
} from "@azure/amqp-common";
TokenCredential,
SharedKeyCredential
} from "@azure/core-amqp";
import { ServiceBusClientOptions } from "./serviceBusClient";
import { ClientEntityContext } from "./clientEntityContext";
import { OnAmqpEvent, EventContext, ConnectionEvents } from "rhea-promise";
Expand All @@ -21,7 +22,7 @@ import { OnAmqpEvent, EventContext, ConnectionEvents } from "rhea-promise";
* @internal
* @interface ConnectionContext
* Provides contextual information like the underlying amqp connection, cbs session, management session,
* tokenProvider, senders, receivers, etc. about the ServiceBus client.
* tokenCredential, senders, receivers, etc. about the ServiceBus client.
*/
export interface ConnectionContext extends ConnectionContextBase {
/**
Expand All @@ -45,13 +46,13 @@ export namespace ConnectionContext {

export function create(
config: ConnectionConfig,
tokenProvider: TokenProvider,
tokenCredential: SharedKeyCredential | TokenCredential,
options?: ServiceBusClientOptions
): ConnectionContext {
if (!options) options = {};
const parameters: CreateConnectionContextBaseParameters = {
config: config,
tokenProvider: tokenProvider,
tokenCredential: tokenCredential,
dataTransformer: options.dataTransformer,
isEntityPathRequired: false,
connectionProperties: {
Expand Down
12 changes: 8 additions & 4 deletions sdk/servicebus/service-bus/src/core/batchingReceiver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Licensed under the MIT License.

import * as log from "../log";
import { Constants, translate, MessagingError } from "@azure/amqp-common";
import { Constants, translate, MessagingError } from "@azure/core-amqp";
import { ReceiverEvents, EventContext, OnAmqpEvent, SessionEvents, AmqpError } from "rhea-promise";
import { ServiceBusMessage, ReceiveMode } from "../serviceBusMessage";
import {
Expand Down Expand Up @@ -77,7 +77,7 @@ export class BatchingReceiver extends MessageReceiver {
throwErrorIfConnectionClosed(this._context.namespace);

if (maxWaitTimeInSeconds == null) {
maxWaitTimeInSeconds = Constants.defaultOperationTimeoutInSeconds;
maxWaitTimeInSeconds = Constants.defaultOperationTimeoutInMs / 1000;
}

const brokeredMessages: ServiceBusMessage[] = [];
Expand All @@ -95,7 +95,7 @@ export class BatchingReceiver extends MessageReceiver {
receiver.session.removeListener(SessionEvents.sessionError, onSessionError);

const sessionError = context.session && context.session.error;
let error = new MessagingError("An error occurred while receiving messages.");
let error: Error | MessagingError;
if (sessionError) {
error = translate(sessionError);
log.error(
Expand All @@ -104,6 +104,8 @@ export class BatchingReceiver extends MessageReceiver {
this.name,
error
);
} else {
error = new MessagingError("An error occurred while receiving messages.");
}
if (totalWaitTimer) {
clearTimeout(totalWaitTimer);
Expand Down Expand Up @@ -276,7 +278,7 @@ export class BatchingReceiver extends MessageReceiver {
receiver.session.removeListener(SessionEvents.sessionError, onSessionError);

const receiverError = context.receiver && context.receiver.error;
let error = new MessagingError("An error occurred while receiving messages.");
let error: Error | MessagingError;
if (receiverError) {
error = translate(receiverError);
log.error(
Expand All @@ -285,6 +287,8 @@ export class BatchingReceiver extends MessageReceiver {
this.name,
error
);
} else {
error = new MessagingError("An error occurred while receiving messages.");
}
if (totalWaitTimer) {
clearTimeout(totalWaitTimer);
Expand Down
Loading