How to use the @azure/core-amqp.Constants.connectionReconnectDelay function in @azure/core-amqp

To help you get started, we’ve selected a few @azure/core-amqp 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 / connectionContext.ts View on Github external
// Close the cbs session to ensure all the event handlers are released.
      await connectionContext.cbsSession.close();
      // Close the management session to ensure all the event handlers are released.
      await connectionContext.managementSession!.close();

      // The connection should always be brought back up if the sdk did not call connection.close()
      // and there was atleast one sender/receiver link on the connection before it went down.
      logger.verbose("[%s] state: %O", connectionContext.connection.id, state);
      if (!state.wasConnectionCloseCalled && (state.numSenders || state.numReceivers)) {
        logger.verbose(
          "[%s] connection.close() was not called from the sdk and there were some " +
            "sender or receiver links or both. We should reconnect.",
          connectionContext.connection.id
        );
        await delay(Constants.connectionReconnectDelay);
        // reconnect senders if any
        for (const senderName of Object.keys(connectionContext.senders)) {
          const sender = connectionContext.senders[senderName];
          if (!sender.isConnecting) {
            logger.verbose(
              "[%s] calling detached on sender '%s' with address '%s'.",
              connectionContext.connection.id,
              sender.name,
              sender.address
            );
            sender.onDetached(connectionError || contextError).catch((err) => {
              logger.verbose(
                "[%s] An error occurred while reconnecting the sender '%s' with adress '%s' %O.",
                connectionContext.connection.id,
                sender.name,
                sender.address,