We will be sunsetting Advisor during Jan, 2026 and will instead be providing information in Snyk Security DB.

You can begin to take advantage of Snyk Security DB today for a unified, package-centric experience.

How to use the @azure/amqp-common.retry function in @azure/amqp-common

To help you get started, we’ve selected a few @azure/amqp-common examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Azure / azure-sdk-for-js / sdk / eventhub / event-hubs / src / eventHubReceiver.ts View on Github external
// if messages were received by the receiver before it got disconnected.
        if (this._checkpoint.sequenceNumber > -1) {
          rcvrOptions.eventPosition = EventPosition.fromSequenceNumber(this._checkpoint.sequenceNumber);
        }
        const options: ReceiverOptions = this._createReceiverOptions(rcvrOptions);
        // 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.receiverLink,
          times: Constants.defaultConnectionRetryAttempts,
          connectionHost: this._context.config.host,
          delayInSeconds: 15
        };
        await retry(config);
      }
    } catch (err) {
      log.error(
        "[%s] An error occurred while processing detached() of Receiver '%s' with address " + "'%s': %O",
        this._context.connectionId,
        this.name,
        this.address,
        err
      );
    }
  }
github Azure / azure-sdk-for-js / sdk / servicebus / service-bus / src / core / messageSender.ts View on Github external
await defaultLock.acquire(this.senderLock, () => {
          const options: SenderOptions = this._createSenderOptions({
            newName: 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.namespace.connectionId!,
            operationType: RetryOperationType.senderLink,
            times: Constants.defaultConnectionRetryAttempts,
            connectionHost: this._context.namespace.config.host,
            delayInSeconds: 15
          };
          return retry(config);
        });
      }
github Azure / azure-sdk-for-js / lib / core / messageReceiver.ts View on Github external
);
      }
      if (shouldReopen) {
        // provide a new name to the link while re-connecting it. This ensures that
        // the service does not send an error stating that the link is still open.
        const options: ReceiverOptions = this._createReceiverOptions(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: connectionId,
          operationType: RetryOperationType.receiverLink,
          times: Constants.defaultConnectionRetryAttempts,
          delayInSeconds: 15
        };
        await retry(config);
      }
    } catch (err) {
      log.error(
        "[%s] An error occurred while processing detached() of Receiver '%s': %O ",
        connectionId,
        this.name,
        this.address,
        err
      );
    }
  }
github Azure / azure-sdk-for-js / sdk / servicebus / service-bus / src / core / messageReceiver.ts View on Github external
);
                await this.close();
              } else {
                if (this._receiver && this.receiverType === ReceiverType.streaming) {
                  this._receiver.addCredit(this.maxConcurrentCalls);
                }
              }
            }),
          connectionId: connectionId,
          operationType: RetryOperationType.receiverLink,
          times: Constants.defaultConnectionRetryAttempts,
          connectionHost: this._context.namespace.config.host,
          delayInSeconds: 15
        };
        if (!this.wasCloseInitiated) {
          await retry(config);
        }
      }
    } catch (err) {
      log.error(
        "[%s] An error occurred while processing detached() of Receiver '%s': %O ",
        connectionId,
        this.name,
        this.address,
        err
      );
    }
  }
github Azure / azure-sdk-for-js / sdk / servicebus / service-bus / src / core / messageReceiver.ts View on Github external
await this.close();
              } else {
                if (this._receiver && this.receiverType === ReceiverType.streaming) {
                  this._receiver.addCredit(this.maxConcurrentCalls);
                }
              }
              return;
            }),
          connectionId: connectionId,
          operationType: RetryOperationType.receiverLink,
          times: Constants.defaultConnectionRetryAttempts,
          connectionHost: this._context.namespace.config.host,
          delayInSeconds: 15
        };
        if (!this.wasCloseInitiated) {
          await retry(config);
        }
      }
    } catch (err) {
      log.error(
        "[%s] An error occurred while processing detached() of Receiver '%s': %O ",
        connectionId,
        this.name,
        this.address,
        err
      );
      if (typeof this._onError === "function") {
        log.error(
          "[%s] Unable to automatically reconnect Receiver '%s' with address '%s'.",
          connectionId,
          this.name,
          this.address
github Azure / azure-sdk-for-js / sdk / servicebus / service-bus / src / core / messageSender.ts View on Github external
description: msg
          };
          reject(translate(amqpError));
        }
      });

    const jitterInSeconds = randomNumberFromInterval(1, 4);
    const config: RetryConfig = {
      operation: sendEventPromise,
      connectionId: this._context.namespace.connectionId!,
      operationType: RetryOperationType.sendMessage,
      times: Constants.defaultRetryAttempts,
      delayInSeconds: Constants.defaultDelayBetweenOperationRetriesInSeconds + jitterInSeconds
    };

    return retry(config);
  }