@azure/event-hubs
Advanced tools
Comparing version 5.0.0-dev.20191210.1 to 5.0.0-dev.20191211.1
@@ -0,1 +1,6 @@ | ||
### 5.0.0-preview.8 | ||
- Fixed potential issues with claims being mismanaged when subscriptions terminate. | ||
- Improved reporting of errors that occur when attempting to claim partitions from CheckpointStores. | ||
### 2019-12-03 5.0.0-preview.7 | ||
@@ -2,0 +7,0 @@ |
@@ -6,3 +6,3 @@ // Copyright (c) Microsoft Corporation. All rights reserved. | ||
import { EventPosition } from "./eventPosition"; | ||
import { PumpManager } from "./pumpManager"; | ||
import { PumpManagerImpl } from "./pumpManager"; | ||
import { AbortController } from "@azure/abort-controller"; | ||
@@ -88,3 +88,3 @@ import * as log from "./log"; | ||
this._processorOptions = options; | ||
this._pumpManager = options.pumpManager || new PumpManager(this._id, this._processorOptions); | ||
this._pumpManager = options.pumpManager || new PumpManagerImpl(this._id, this._processorOptions); | ||
const inactiveTimeLimitInMS = options.inactiveTimeLimitInMs || this._inactiveTimeLimitInMs; | ||
@@ -126,5 +126,6 @@ this._partitionLoadBalancer = | ||
const claimedOwnerships = yield this._checkpointStore.claimOwnership([ownershipRequest]); | ||
// since we only claim one ownership at a time, check the array length and throw | ||
// can happen if the partition was claimed out from underneath us - we shouldn't | ||
// attempt to spin up a processor. | ||
if (!claimedOwnerships.length) { | ||
throw new Error(`Failed to claim ownership of partition ${ownershipRequest.partitionId}`); | ||
return; | ||
} | ||
@@ -276,3 +277,2 @@ log.partitionLoadBalancer(`[${this._id}] Successfully claimed ownership of partition ${ownershipRequest.partitionId}.`); | ||
return __awaiter(this, void 0, void 0, function* () { | ||
yield this.abandonPartitionOwnerships(); | ||
log.eventProcessor(`[${this._id}] Stopping an EventProcessor.`); | ||
@@ -297,2 +297,3 @@ if (this._abortController) { | ||
} | ||
yield this.abandonPartitionOwnerships(); | ||
}); | ||
@@ -308,3 +309,3 @@ } | ||
} | ||
this._checkpointStore.claimOwnership(ourOwnerships); | ||
return this._checkpointStore.claimOwnership(ourOwnerships); | ||
}); | ||
@@ -311,0 +312,0 @@ } |
import { __awaiter } from "tslib"; | ||
import * as log from "./log"; | ||
/** | ||
@@ -120,3 +121,8 @@ * The `PartitionProcessor` is responsible for processing events received from Event Hubs when using `EventProcessor` | ||
if (this._eventHandlers.processError) { | ||
yield this._eventHandlers.processError(error, this); | ||
try { | ||
yield this._eventHandlers.processError(error, this); | ||
} | ||
catch (err) { | ||
log.partitionPump(`Error thrown from user's processError handler : ${err}`); | ||
} | ||
} | ||
@@ -123,0 +129,0 @@ }); |
@@ -29,4 +29,5 @@ // Copyright (c) Microsoft Corporation. All rights reserved. | ||
} | ||
catch (_a) { | ||
catch (err) { | ||
// swallow the error from the user-defined code | ||
this._partitionProcessor.processError(err); | ||
} | ||
@@ -108,2 +109,3 @@ const startingPosition = getStartingPosition(this._originalInitialEventPosition, userRequestedDefaultPosition); | ||
log.error("An error occurred while closing the receiver.", err); | ||
this._partitionProcessor.processError(err); | ||
throw err; | ||
@@ -110,0 +112,0 @@ } |
@@ -12,4 +12,5 @@ // Copyright (c) Microsoft Corporation. All rights reserved. | ||
* @ignore | ||
* @internal | ||
*/ | ||
export class PumpManager { | ||
export class PumpManagerImpl { | ||
/** | ||
@@ -16,0 +17,0 @@ * @ignore |
@@ -8,4 +8,4 @@ // Copyright (c) Microsoft Corporation. All rights reserved. | ||
name: "@azure/event-hubs", | ||
version: "5.0.0-preview.7" | ||
version: "5.0.0-preview.8" | ||
}; | ||
//# sourceMappingURL=constants.js.map |
{ | ||
"name": "@azure/event-hubs", | ||
"sdk-type": "client", | ||
"version": "5.0.0-dev.20191210.1", | ||
"version": "5.0.0-dev.20191211.1", | ||
"description": "Azure Event Hubs SDK for JS.", | ||
@@ -6,0 +6,0 @@ "author": "Microsoft Corporation", |
@@ -7,3 +7,3 @@ // Copyright (c) Microsoft Corporation. All rights reserved. | ||
import { EventPosition } from "./eventPosition"; | ||
import { PumpManager } from "./pumpManager"; | ||
import { PumpManager, PumpManagerImpl } from "./pumpManager"; | ||
import { AbortController, AbortSignalLike } from "@azure/abort-controller"; | ||
@@ -262,3 +262,3 @@ import * as log from "./log"; | ||
this._processorOptions = options; | ||
this._pumpManager = options.pumpManager || new PumpManager(this._id, this._processorOptions); | ||
this._pumpManager = options.pumpManager || new PumpManagerImpl(this._id, this._processorOptions); | ||
const inactiveTimeLimitInMS = options.inactiveTimeLimitInMs || this._inactiveTimeLimitInMs; | ||
@@ -310,5 +310,7 @@ this._partitionLoadBalancer = | ||
const claimedOwnerships = await this._checkpointStore.claimOwnership([ownershipRequest]); | ||
// since we only claim one ownership at a time, check the array length and throw | ||
// can happen if the partition was claimed out from underneath us - we shouldn't | ||
// attempt to spin up a processor. | ||
if (!claimedOwnerships.length) { | ||
throw new Error(`Failed to claim ownership of partition ${ownershipRequest.partitionId}`); | ||
return; | ||
} | ||
@@ -504,4 +506,2 @@ | ||
async stop(): Promise<void> { | ||
await this.abandonPartitionOwnerships(); | ||
log.eventProcessor(`[${this._id}] Stopping an EventProcessor.`); | ||
@@ -526,2 +526,4 @@ if (this._abortController) { | ||
} | ||
await this.abandonPartitionOwnerships(); | ||
} | ||
@@ -536,3 +538,3 @@ | ||
} | ||
this._checkpointStore.claimOwnership(ourOwnerships); | ||
return this._checkpointStore.claimOwnership(ourOwnerships); | ||
} | ||
@@ -539,0 +541,0 @@ } |
@@ -9,3 +9,4 @@ import { CloseReason, CheckpointStore } from "./eventProcessor"; | ||
} from "./eventHubConsumerClientModels"; | ||
import { EventPosition } from "."; | ||
import { EventPosition } from "./eventPosition"; | ||
import * as log from "./log"; | ||
@@ -180,3 +181,7 @@ /** | ||
if (this._eventHandlers.processError) { | ||
await this._eventHandlers.processError(error, this); | ||
try { | ||
await this._eventHandlers.processError(error, this); | ||
} catch (err) { | ||
log.partitionPump(`Error thrown from user's processError handler : ${err}`); | ||
} | ||
} | ||
@@ -183,0 +188,0 @@ } |
@@ -45,4 +45,5 @@ // Copyright (c) Microsoft Corporation. All rights reserved. | ||
userRequestedDefaultPosition = await this._partitionProcessor.initialize(); | ||
} catch { | ||
} catch (err) { | ||
// swallow the error from the user-defined code | ||
this._partitionProcessor.processError(err); | ||
} | ||
@@ -141,2 +142,3 @@ | ||
log.error("An error occurred while closing the receiver.", err); | ||
this._partitionProcessor.processError(err); | ||
throw err; | ||
@@ -143,0 +145,0 @@ } |
@@ -16,4 +16,35 @@ // Copyright (c) Microsoft Corporation. All rights reserved. | ||
* @ignore | ||
* @internal | ||
*/ | ||
export class PumpManager { | ||
export interface PumpManager { | ||
/** | ||
* Creates and starts a PartitionPump. | ||
* @param eventHubClient The EventHubClient to forward to the PartitionPump. | ||
* @param initialEventPosition The EventPosition to forward to the PartitionPump. | ||
* @param partitionProcessor The PartitionProcessor to forward to the PartitionPump. | ||
* @param abortSignal Used to cancel pump creation. | ||
* @ignore | ||
*/ | ||
createPump( | ||
eventHubClient: EventHubClient, | ||
initialEventPosition: EventPosition | undefined, | ||
partitionProcessor: PartitionProcessor | ||
): Promise<void>; | ||
/** | ||
* Stops all PartitionPumps and removes them from the internal map. | ||
* @param reason The reason for removing the pump. | ||
* @ignore | ||
*/ | ||
removeAllPumps(reason: CloseReason): Promise<void>; | ||
} | ||
/** | ||
* The PumpManager handles the creation and removal of PartitionPumps. | ||
* It also starts a PartitionPump when it is created, and stops a | ||
* PartitionPump when it is removed. | ||
* @ignore | ||
* @internal | ||
*/ | ||
export class PumpManagerImpl implements PumpManager { | ||
private readonly _eventProcessorName: string; | ||
@@ -20,0 +51,0 @@ private readonly _options: FullEventProcessorOptions; |
@@ -9,3 +9,3 @@ // Copyright (c) Microsoft Corporation. All rights reserved. | ||
name: "@azure/event-hubs", | ||
version: "5.0.0-preview.7" | ||
version: "5.0.0-preview.8" | ||
}; |
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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1320453
17364
5
2
135