Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// 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,
this.address,
err
);
}
}
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);
});
}
const amqpError: AmqpError = {
condition: ErrorNameConditionMapper.SenderBusyError,
description: msg
};
reject(translate(amqpError));
}
});
const config: RetryConfig = {
operation: sendEventPromise,
connectionId: this._context.connectionId,
operationType: RetryOperationType.sendMessage,
abortSignal: abortSignal,
retryOptions: retryOptions
};
return retry(config);
}
address,
err
);
logErrorStackTrace(err);
reject(err);
}
});
const config: RetryConfig = {
operation: sendOperationPromise,
connectionId: this._context.connectionId,
operationType: RetryOperationType.management,
abortSignal: abortSignal,
retryOptions: retryOptions
};
return (await retry(config)).body;
} catch (err) {
err = translate(err);
logger.warning("An error occurred while making the request to $management endpoint: %O", err);
logErrorStackTrace(err);
throw err;
}
}
if (abortSignal && !abortSignal.aborted) {
abortSignal.addEventListener("abort", onAbort);
}
});
};
const retryOptions = this._retryOptions;
const config: RetryConfig = {
connectionHost: this._context.config.host,
connectionId: this._context.connectionId,
operation: retrieveEvents,
operationType: RetryOperationType.receiveMessage,
abortSignal: abortSignal,
retryOptions: retryOptions
};
return retry(config);
}