How to use the @azure/event-hubs.AadTokenProvider 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 / eventProcessorHost.ts View on Github external
validateType("hostName", hostName, true, "string");
    validateType("namespace", namespace, true, "string");
    validateType("eventHubPath", eventHubPath, true, "string");
    validateType("credentials", credentials, true, "object");
    validateType("checkpointManager", checkpointManager, true, "object");
    validateType("leaseManager", leaseManager, true, "object");
    validateType("options", options, false, "object");

    if (!namespace.endsWith("/")) namespace += "/";
    const connectionString =
      `Endpoint=sb://${namespace};SharedAccessKeyName=defaultKeyName;` +
      `SharedAccessKey=defaultKeyValue;EntityPath=${eventHubPath}`;
    const ephOptions: EventProcessorHostOptions = {
      ...options,
      tokenProvider: new AadTokenProvider(credentials),
      eventHubPath: eventHubPath,
      eventHubConnectionString: connectionString,
      checkpointManager: checkpointManager,
      leaseManager: leaseManager
    };
    return new EventProcessorHost(hostName, ephOptions);
  }
github Azure / azure-sdk-for-js / sdk / eventhub / event-processor-host / src / eventProcessorHost.ts View on Github external
validateType("hostName", hostName, true, "string");
    validateType("storageConnectionString", storageConnectionString, true, "string");
    validateType("storageContainerName", storageContainerName, true, "string");
    validateType("namespace", namespace, true, "string");
    validateType("eventHubPath", eventHubPath, true, "string");
    validateType("credentials", credentials, true, "object");
    validateType("options", options, false, "object");

    if (!namespace.endsWith("/")) namespace += "/";
    const connectionString =
      `Endpoint=sb://${namespace};SharedAccessKeyName=defaultKeyName;` +
      `SharedAccessKey=defaultKeyValue;EntityPath=${eventHubPath}`;

    const ephOptions: EventProcessorHostOptions = {
      ...options,
      tokenProvider: new AadTokenProvider(credentials),
      storageConnectionString: storageConnectionString,
      storageContainerName: storageContainerName,
      eventHubPath: eventHubPath,
      eventHubConnectionString: connectionString
    };
    return new EventProcessorHost(hostName, ephOptions);
  }