How to use the @azure/event-hubs.ErrorNameConditionMapper.ReceiverDisconnectedError function in @azure/event-hubs

To help you get started, we’ve selected a few @azure/event-hubs 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-processor-host / src / partitionPump.ts View on Github external
private _isReceiverDisconnectedError(error: MessagingError | Error): boolean {
    const partitionId = this._partitionContext.partitionId;
    const withHostAndPartition = this._context.withHostAndPartition;
    let result = false;
    if (error) {
      // condition is "amqp:link:stolen"
      if (
        (error as MessagingError).condition === ErrorNameConditionMapper.ReceiverDisconnectedError
      ) {
        result = true;
      } else if (error.message.match(/.*New receiver with higher epoch.*/i) !== null) {
        result = true;
        log.error(
          withHostAndPartition(
            partitionId,
            "It looks like the error should have " +
              "been a 'ReceiverDisconnectedError', however it was not translated correctly: %O."
          ),
          error
        );
      }
    }
    return result;
  }