Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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,
this.address,
err
);
}
}
// close this receiver when user triggers a cancellation.
this.close().catch(() => {}); // no-op close error handler
}
onError(error);
};
const onAbort = () => {
if (this._baseConsumer) {
this._baseConsumer.abort();
}
};
baseConsumer.registerHandlers(
onMessage,
wrappedOnError,
Constants.defaultPrefetchCount,
true,
abortSignal,
onAbort
);
if (
this._receiverOptions.trackLastEnqueuedEventProperties &&
this._baseConsumer &&
this._baseConsumer.runtimeInfo
) {
this._lastEnqueuedEventProperties = this._baseConsumer.runtimeInfo;
}
return new ReceiveHandler(baseConsumer);
}