@azure/event-hubs
Advanced tools
Comparing version 5.0.1-dev.20200206.1 to 5.0.1-dev.20200208.1
@@ -7,4 +7,8 @@ # Release History | ||
starve out other consumers, preventing us from properly balancing. | ||
- Updated to use the latest version of the `@azure/core-amqp` package. | ||
- Fixed an issue where calling `subscription.close()` immediately | ||
after calling `subscribe` would cause events to still be read. | ||
- Updated to use the latest version of the `@azure/core-amqp` package which in | ||
turn uses the latest version of the `rhea` package. | ||
This update improves support for [bundling](https://github.com/Azure/azure-sdk-for-js/blob/master/documentation/Bundling.md) this library. | ||
([Pull Request](https://github.com/amqp/rhea/pull/274)) | ||
@@ -11,0 +15,0 @@ ## 5.0.0 (2020-01-09) |
@@ -20,3 +20,3 @@ // Copyright (c) Microsoft Corporation. All rights reserved. | ||
*/ | ||
const userAgent = `azsdk-js-azureeventhubs/${packageJsonInfo.version} (NODE-VERSION ${getRuntimeInfo()})`; | ||
const userAgent = `azsdk-js-azureeventhubs/${packageJsonInfo.version} (${getRuntimeInfo()})`; | ||
function getUserAgent(options) { | ||
@@ -23,0 +23,0 @@ const finalUserAgent = options.userAgent ? `${userAgent},${options.userAgent}` : userAgent; |
@@ -107,4 +107,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. | ||
*/ | ||
_claimOwnership(ownershipRequest) { | ||
_claimOwnership(ownershipRequest, abortSignal) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
if (abortSignal.aborted) { | ||
logger.verbose(`[${this._id}] Subscription was closed before claiming ownership of ${ownershipRequest.partitionId}.`); | ||
return; | ||
} | ||
logger.info(`[${this._id}] Attempting to claim ownership of partition ${ownershipRequest.partitionId}.`); | ||
@@ -119,3 +123,3 @@ try { | ||
logger.info(`[${this._id}] Successfully claimed ownership of partition ${ownershipRequest.partitionId}.`); | ||
yield this._startPump(ownershipRequest.partitionId); | ||
yield this._startPump(ownershipRequest.partitionId, abortSignal); | ||
} | ||
@@ -129,4 +133,8 @@ catch (err) { | ||
} | ||
_startPump(partitionId) { | ||
_startPump(partitionId, abortSignal) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
if (abortSignal.aborted) { | ||
logger.verbose(`[${this._id}] The subscription was closed before starting to read from ${partitionId}.`); | ||
return; | ||
} | ||
if (this._pumpManager.isReceivingFromPartition(partitionId)) { | ||
@@ -145,3 +153,3 @@ logger.verbose(`[${this._id}] There is already an active partitionPump for partition "${partitionId}", skipping pump creation.`); | ||
const eventPosition = yield this._getStartingPosition(partitionId); | ||
yield this._pumpManager.createPump(eventPosition, this._eventHubClient, partitionProcessor); | ||
yield this._pumpManager.createPump(eventPosition, this._eventHubClient, partitionProcessor, abortSignal); | ||
logger.verbose(`[${this._id}] PartitionPump created successfully.`); | ||
@@ -165,3 +173,3 @@ }); | ||
try { | ||
yield this._startPump(partitionId); | ||
yield this._startPump(partitionId, abortSignal); | ||
} | ||
@@ -180,2 +188,3 @@ catch (err) { | ||
} | ||
this._isRunning = false; | ||
}); | ||
@@ -226,3 +235,3 @@ } | ||
} | ||
yield this._claimOwnership(ownershipRequest); | ||
yield this._claimOwnership(ownershipRequest, abortSignal); | ||
} | ||
@@ -244,2 +253,3 @@ } | ||
} | ||
this._isRunning = false; | ||
}); | ||
@@ -317,3 +327,2 @@ } | ||
} | ||
this._isRunning = false; | ||
try { | ||
@@ -320,0 +329,0 @@ // remove all existing pumps |
@@ -50,5 +50,9 @@ // Copyright (c) Microsoft Corporation. All rights reserved. | ||
*/ | ||
createPump(startPosition, eventHubClient, partitionProcessor) { | ||
createPump(startPosition, eventHubClient, partitionProcessor, abortSignal) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const partitionId = partitionProcessor.partitionId; | ||
if (abortSignal.aborted) { | ||
logger.verbose(`${this._eventProcessorName}] The subscription was closed before creating the pump for partition ${partitionId}.`); | ||
return; | ||
} | ||
// attempt to get an existing pump | ||
@@ -55,0 +59,0 @@ const existingPump = this._partitionIdToPumps[partitionId]; |
@@ -7,3 +7,3 @@ /** | ||
export function getRuntimeInfo() { | ||
return `v0.0.0; Browser ${getReleaseInfo()}`; | ||
return `BROWSER-VERSION; Browser ${getReleaseInfo()}`; | ||
} | ||
@@ -10,0 +10,0 @@ function getReleaseInfo() { |
@@ -10,4 +10,4 @@ // Copyright (c) Microsoft Corporation. All rights reserved. | ||
export function getRuntimeInfo() { | ||
return `${process.version}; ${os.type()} ${os.release()}`; | ||
return `NODE-VERSION ${process.version}; ${os.type()} ${os.release()}`; | ||
} | ||
//# sourceMappingURL=runtimeInfo.js.map |
{ | ||
"name": "@azure/event-hubs", | ||
"sdk-type": "client", | ||
"version": "5.0.1-dev.20200206.1", | ||
"version": "5.0.1-dev.20200208.1", | ||
"description": "Azure Event Hubs SDK for JS.", | ||
@@ -74,3 +74,3 @@ "author": "Microsoft Corporation", | ||
"@azure/abort-controller": "^1.0.0", | ||
"@azure/core-amqp": "^1.0.1-dev", | ||
"@azure/core-amqp": "^1.0.1", | ||
"@azure/core-asynciterator-polyfill": "^1.0.0", | ||
@@ -94,5 +94,8 @@ "@azure/core-tracing": "^1.0.0-dev", | ||
"@microsoft/api-extractor": "^7.5.4", | ||
"@rollup/plugin-commonjs": "^11.0.1", | ||
"@rollup/plugin-inject": "^4.0.0", | ||
"@rollup/plugin-json": "^4.0.0", | ||
"@rollup/plugin-multi-entry": "^3.0.0", | ||
"@rollup/plugin-node-resolve": "^7.0.0", | ||
"@rollup/plugin-replace": "^2.2.0", | ||
"@rollup/plugin-multi-entry": "^3.0.0", | ||
"@types/async-lock": "^1.1.0", | ||
@@ -143,5 +146,2 @@ "@types/chai": "^4.1.6", | ||
"rollup": "^1.16.3", | ||
"@rollup/plugin-commonjs": "^11.0.1", | ||
"@rollup/plugin-inject": "^4.0.0", | ||
"@rollup/plugin-node-resolve": "^7.0.0", | ||
"rollup-plugin-shim": "^1.0.0", | ||
@@ -153,5 +153,5 @@ "rollup-plugin-sourcemaps": "^0.4.2", | ||
"ts-node": "^8.3.0", | ||
"typescript": "~3.6.4", | ||
"typescript": "~3.7.5", | ||
"ws": "^7.1.1" | ||
} | ||
} |
@@ -74,3 +74,3 @@ // Copyright (c) Microsoft Corporation. All rights reserved. | ||
packageJsonInfo.version | ||
} (NODE-VERSION ${getRuntimeInfo()})`; | ||
} (${getRuntimeInfo()})`; | ||
@@ -77,0 +77,0 @@ export function getUserAgent(options: ConnectionContextOptions): string { |
@@ -252,3 +252,12 @@ // Copyright (c) Microsoft Corporation. All rights reserved. | ||
*/ | ||
private async _claimOwnership(ownershipRequest: PartitionOwnership): Promise<void> { | ||
private async _claimOwnership( | ||
ownershipRequest: PartitionOwnership, | ||
abortSignal: AbortSignalLike | ||
): Promise<void> { | ||
if (abortSignal.aborted) { | ||
logger.verbose( | ||
`[${this._id}] Subscription was closed before claiming ownership of ${ownershipRequest.partitionId}.` | ||
); | ||
return; | ||
} | ||
logger.info( | ||
@@ -270,3 +279,3 @@ `[${this._id}] Attempting to claim ownership of partition ${ownershipRequest.partitionId}.` | ||
await this._startPump(ownershipRequest.partitionId); | ||
await this._startPump(ownershipRequest.partitionId, abortSignal); | ||
} catch (err) { | ||
@@ -281,3 +290,10 @@ logger.warning( | ||
private async _startPump(partitionId: string) { | ||
private async _startPump(partitionId: string, abortSignal: AbortSignalLike) { | ||
if (abortSignal.aborted) { | ||
logger.verbose( | ||
`[${this._id}] The subscription was closed before starting to read from ${partitionId}.` | ||
); | ||
return; | ||
} | ||
if (this._pumpManager.isReceivingFromPartition(partitionId)) { | ||
@@ -307,3 +323,8 @@ logger.verbose( | ||
const eventPosition = await this._getStartingPosition(partitionId); | ||
await this._pumpManager.createPump(eventPosition, this._eventHubClient, partitionProcessor); | ||
await this._pumpManager.createPump( | ||
eventPosition, | ||
this._eventHubClient, | ||
partitionProcessor, | ||
abortSignal | ||
); | ||
@@ -340,3 +361,3 @@ logger.verbose(`[${this._id}] PartitionPump created successfully.`); | ||
try { | ||
await this._startPump(partitionId); | ||
await this._startPump(partitionId, abortSignal); | ||
} catch (err) { | ||
@@ -355,2 +376,3 @@ logger.warning(`[${this._id}] An error occured within the EventProcessor loop: ${err}`); | ||
} | ||
this._isRunning = false; | ||
} | ||
@@ -424,3 +446,3 @@ | ||
await this._claimOwnership(ownershipRequest); | ||
await this._claimOwnership(ownershipRequest, abortSignal); | ||
} | ||
@@ -442,2 +464,3 @@ } | ||
} | ||
this._isRunning = false; | ||
} | ||
@@ -525,3 +548,2 @@ | ||
this._isRunning = false; | ||
try { | ||
@@ -528,0 +550,0 @@ // remove all existing pumps |
@@ -11,2 +11,3 @@ // Copyright (c) Microsoft Corporation. All rights reserved. | ||
import { logger, logErrorStackTrace } from "./log"; | ||
import { AbortSignalLike } from "@azure/abort-controller"; | ||
@@ -32,3 +33,4 @@ /** | ||
eventHubClient: EventHubClient, | ||
partitionProcessor: PartitionProcessor | ||
partitionProcessor: PartitionProcessor, | ||
abortSignal: AbortSignalLike | ||
): Promise<void>; | ||
@@ -106,5 +108,12 @@ | ||
eventHubClient: EventHubClient, | ||
partitionProcessor: PartitionProcessor | ||
partitionProcessor: PartitionProcessor, | ||
abortSignal: AbortSignalLike | ||
): Promise<void> { | ||
const partitionId = partitionProcessor.partitionId; | ||
if (abortSignal.aborted) { | ||
logger.verbose( | ||
`${this._eventProcessorName}] The subscription was closed before creating the pump for partition ${partitionId}.` | ||
); | ||
return; | ||
} | ||
// attempt to get an existing pump | ||
@@ -111,0 +120,0 @@ const existingPump = this._partitionIdToPumps[partitionId]; |
@@ -19,3 +19,3 @@ // Copyright (c) Microsoft Corporation. All rights reserved. | ||
export function getRuntimeInfo(): string { | ||
return `v0.0.0; Browser ${getReleaseInfo()}`; | ||
return `BROWSER-VERSION; Browser ${getReleaseInfo()}`; | ||
} | ||
@@ -22,0 +22,0 @@ |
@@ -11,3 +11,3 @@ // Copyright (c) Microsoft Corporation. All rights reserved. | ||
export function getRuntimeInfo(): string { | ||
return `${process.version}; ${os.type()} ${os.release()}`; | ||
return `NODE-VERSION ${process.version}; ${os.type()} ${os.release()}`; | ||
} |
@@ -295,3 +295,3 @@ /// <reference types="node" /> | ||
*/ | ||
readonly eventHubName: string; | ||
get eventHubName(): string; | ||
/** | ||
@@ -303,3 +303,3 @@ * @property | ||
*/ | ||
readonly fullyQualifiedNamespace: string; | ||
get fullyQualifiedNamespace(): string; | ||
/** | ||
@@ -500,3 +500,3 @@ * @constructor | ||
*/ | ||
readonly eventHubName: string; | ||
get eventHubName(): string; | ||
/** | ||
@@ -508,3 +508,3 @@ * @property | ||
*/ | ||
readonly fullyQualifiedNamespace: string; | ||
get fullyQualifiedNamespace(): string; | ||
/** | ||
@@ -511,0 +511,0 @@ * @constructor |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
1294140
17029
Updated@azure/core-amqp@^1.0.1