Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
await defaultLock.acquire(this.senderLock, () => {
const options: AwaitableSenderOptions = this._createSenderOptions(
Constants.defaultOperationTimeoutInMs,
true
);
// shall retry forever at an interval of 15 seconds if the error is a retryable error
// else bail out when the error is not retryable or the oepration succeeds.
const config: RetryConfig = {
operation: () => this._init(options),
connectionId: this._context.connectionId,
operationType: RetryOperationType.senderLink,
connectionHost: this._context.config.host,
retryOptions: {
maxRetries: Constants.defaultMaxRetriesForConnection,
retryDelayInMs: 15000
}
};
return retry(config);
});
}
if (this.checkpoint > -1) {
receiverOptions.eventPosition = EventPosition.fromSequenceNumber(this.checkpoint);
}
// create RHEA receiver options
const initOptions = this._createReceiverOptions(receiverOptions);
// attempt to create the link
const linkCreationConfig: RetryConfig = {
connectionId: this._context.connectionId,
connectionHost: this._context.config.host,
operation: () => this.initialize(initOptions),
operationType: RetryOperationType.receiverLink,
retryOptions: {
maxRetries: Constants.defaultMaxRetriesForConnection,
retryDelayInMs: 15000
}
};
await retry(linkCreationConfig);
// if the receiver is in streaming mode we need to add credits again.
if (this._isStreaming) {
this._addCredit(Constants.defaultPrefetchCount);
}
} catch (err) {
logger.verbose(
"[%s] An error occurred while processing onDetached() of Receiver '%s' with address " +
"'%s': %O",
this._context.connectionId,
this.name,