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

[Event Hubs] Rename idempotent retries flag #21730

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
8 changes: 2 additions & 6 deletions sdk/eventhub/event-hubs/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,10 @@
# Release History

## 5.8.0-beta.4 (Unreleased)

### Features Added
## 5.8.0 (Unreleased)

### Breaking Changes

### Bugs Fixed

### Other Changes
- The `enableIdempotentPartitions` flag has been renamed to `enableIdempotentRetries`

## 5.8.0-beta.3 (2022-04-05)

Expand Down
2 changes: 1 addition & 1 deletion sdk/eventhub/event-hubs/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@azure/event-hubs",
"sdk-type": "client",
"version": "5.8.0-beta.4",
"version": "5.8.0",
"description": "Azure Event Hubs SDK for JS.",
"author": "Microsoft Corporation",
"license": "MIT",
Expand Down
2 changes: 1 addition & 1 deletion sdk/eventhub/event-hubs/review/event-hubs.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ export class EventHubBufferedProducerClient {

// @public
export interface EventHubBufferedProducerClientOptions extends EventHubClientOptions {
enableIdempotentPartitions?: boolean;
enableIdempotentRetries?: boolean;
maxEventBufferLengthPerPartition?: number;
maxWaitTimeInMs?: number;
onSendEventsErrorHandler: (ctx: OnSendEventsErrorContext) => Promise<void>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ export interface EventHubBufferedProducerClientOptions extends EventHubClientOpt
* nor will it be able to use a partition key.
* Default: false
*/
enableIdempotentPartitions?: boolean;
enableIdempotentRetries?: boolean;
}

/**
Expand Down Expand Up @@ -292,8 +292,7 @@ export class EventHubBufferedProducerClient {
}

// setting internal idempotent publishing option on the standard producer.
(this._producer as any)._enableIdempotentPartitions =
this._clientOptions.enableIdempotentPartitions;
(this._producer as any)._enableIdempotentRetries = this._clientOptions.enableIdempotentRetries;
}

/**
Expand Down
16 changes: 8 additions & 8 deletions sdk/eventhub/event-hubs/src/eventHubProducerClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ export class EventHubProducerClient {
* nor will it be able to use a partition key.
* Default: false
*/
private _enableIdempotentPartitions?: boolean;
private _enableIdempotentRetries?: boolean;
/**
* The set of options that can be specified to influence publishing behavior specific to the configured Event Hub partition.
* These options are not necessary in the majority of scenarios and are intended for use with specialized scenarios,
Expand Down Expand Up @@ -215,7 +215,7 @@ export class EventHubProducerClient {
const partitionId = isDefined(options.partitionId) ? String(options.partitionId) : undefined;

validateProducerPartitionSettings({
enableIdempotentPartitions: this._enableIdempotentPartitions,
enableIdempotentRetries: this._enableIdempotentRetries,
partitionId,
partitionKey: options.partitionKey,
});
Expand All @@ -226,7 +226,7 @@ export class EventHubProducerClient {
? this._partitionOptions?.[partitionId]
: undefined;
sender = EventHubSender.create(this._context, {
enableIdempotentProducer: Boolean(this._enableIdempotentPartitions),
enableIdempotentProducer: Boolean(this._enableIdempotentRetries),
partitionId,
partitionPublishingOptions,
});
Expand All @@ -252,7 +252,7 @@ export class EventHubProducerClient {
return new EventDataBatchImpl(
this._context,
maxMessageSize,
Boolean(this._enableIdempotentPartitions),
Boolean(this._enableIdempotentRetries),
options.partitionKey,
partitionId
);
Expand Down Expand Up @@ -288,7 +288,7 @@ export class EventHubProducerClient {
let sender = this._sendersMap.get(partitionId);
if (!sender) {
sender = EventHubSender.create(this._context, {
enableIdempotentProducer: Boolean(this._enableIdempotentPartitions),
enableIdempotentProducer: Boolean(this._enableIdempotentRetries),
partitionId,
partitionPublishingOptions: this._partitionOptions?.[partitionId],
});
Expand Down Expand Up @@ -389,7 +389,7 @@ export class EventHubProducerClient {

if (isEventDataBatch(batch)) {
if (
this._enableIdempotentPartitions &&
this._enableIdempotentRetries &&
isDefined((batch as EventDataBatchImpl).startingPublishedSequenceNumber)
) {
throw new Error(idempotentAlreadyPublished);
Expand Down Expand Up @@ -421,7 +421,7 @@ export class EventHubProducerClient {
}

validateProducerPartitionSettings({
enableIdempotentPartitions: this._enableIdempotentPartitions,
enableIdempotentRetries: this._enableIdempotentRetries,
partitionId,
partitionKey,
});
Expand All @@ -436,7 +436,7 @@ export class EventHubProducerClient {
? this._partitionOptions?.[partitionId]
: undefined;
sender = EventHubSender.create(this._context, {
enableIdempotentProducer: Boolean(this._enableIdempotentPartitions),
enableIdempotentProducer: Boolean(this._enableIdempotentRetries),
partitionId,
partitionPublishingOptions,
});
Expand Down
2 changes: 1 addition & 1 deletion sdk/eventhub/event-hubs/src/eventHubSender.ts
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,7 @@ export class EventHubSender extends LinkEntity {
);
if (this._isIdempotentProducer && this._hasPendingSend) {
throw new Error(
`There can only be 1 "sendBatch" call in-flight per partition while "enableIdempotentPartitions" is set to true.`
`There can only be 1 "sendBatch" call in-flight per partition while "enableIdempotentRetries" is set to true.`
);
}

Expand Down
2 changes: 1 addition & 1 deletion sdk/eventhub/event-hubs/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/event-hubs",
version: "5.8.0-beta.4",
version: "5.8.0",
};

/**
Expand Down
8 changes: 4 additions & 4 deletions sdk/eventhub/event-hubs/src/util/error.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,17 +115,17 @@ export const idempotentSomeAlreadyPublished =
* @internal
*/
export function validateProducerPartitionSettings({
enableIdempotentPartitions,
enableIdempotentRetries,
partitionId,
partitionKey,
}: {
enableIdempotentPartitions?: boolean;
enableIdempotentRetries?: boolean;
partitionId?: string;
partitionKey?: string;
}): void {
if (enableIdempotentPartitions && (isDefined(partitionKey) || !isDefined(partitionId))) {
if (enableIdempotentRetries && (isDefined(partitionKey) || !isDefined(partitionId))) {
throw new Error(
`The "partitionId" must be supplied and "partitionKey" must not be provided when the EventHubProducerClient has "enableIdempotentPartitions" set to true.`
`The "partitionId" must be supplied and "partitionKey" must not be provided when the EventHubProducerClient has "enableIdempotentRetries" set to true.`
);
}

Expand Down
Loading