Freigeben über


BlobChangeFeedClient class

Konstruktoren

BlobChangeFeedClient(string, Pipeline)

Erstellt eine Instanz von BlobChangeFeedClient.

BlobChangeFeedClient(string, StorageSharedKeyCredential | AnonymousCredential | TokenCredential, StoragePipelineOptions, BlobChangeFeedClientOptions)

Erstellt eine Instanz von BlobChangeFeedClient.

Methoden

fromConnectionString(string, StoragePipelineOptions, BlobChangeFeedClientOptions)

Erstellt eine Instanz von BlobChangeFeedClient aus verbindungszeichenfolge.

listChanges(BlobChangeFeedListChangesOptions)

Gibt einen asynchronen iterierbaren Iterator zurück, um alle Änderungsfeedereignisse im angegebenen Konto auflisten zu können.

.byPage() gibt einen asynchronen iterablen Iterator zurück, um die Änderungsfeedereignisse auf Seiten auflisten zu können.

Beispiel mit for await Syntax:

let i = 1;
for await (const event of blobChangeFeedClient.listChanges()) {
  console.log(`Event ${i++}, type: ${event.eventType}`);
}

Beispiel für die Verwendung von iter.next():

let i = 1;
const iter = blobChangeFeedClient.listChanges();
let eventItem = await iter.next();
while (!eventItem.done) {
  console.log(`Event ${i++}, type: ${eventItem.eventType}`);
  eventItem = await iter.next();
}

Beispiel für die Verwendung von byPage():

// passing optional maxPageSize in the page settings
let i = 1;
for await (const eventPage of blobChangeFeedClient.listChanges().byPage({ maxPageSize: 20 })) {
  if (eventPage.events) {
    for (const event of eventPage.events) {
      console.log(`Event ${i++}, type: ${event.eventType}`);
    }
  }
}

Beispiel für das Paging mit einer Markierung:

let i = 1;
let iterator = blobChangeFeedClient.listChanges().byPage({ maxPageSize: 2 });
let eventPage = (await iterator.next()).value;

if (eventPage.events) {
  for (const container of eventPage.events) {
    console.log(`Event ${i++}, type: ${event.eventType}`);
  }
}

// Gets next marker
let marker = eventPage.continuationToken;
// Passing next marker as continuationToken
iterator = blobChangeFeedClient
  .listChanges()
  .byPage({ continuationToken: marker, maxPageSize: 10 });
eventPage = (await iterator.next()).value;

if (eventPage.events) {
  for (const container of eventPage.events) {
     console.log(`Event ${i++}, type: ${event.eventType}`);
  }
}

Details zum Konstruktor

BlobChangeFeedClient(string, Pipeline)

Erstellt eine Instanz von BlobChangeFeedClient.

new BlobChangeFeedClient(url: string, pipeline: Pipeline)

Parameter

url

string

Eine Clientzeichenfolge, die auf den Azure Storage-BLOB-Dienst verweist, z. B. "https://myaccount.blob.core.windows.net". Sie können eine SAS anfügen, wenn Anonyme Anmeldeinformationen verwendet werden, z. B. "https://myaccount.blob.core.windows.net?sasString".

pipeline
Pipeline

Rufen Sie newPipeline() auf, um eine Standardpipeline zu erstellen oder eine angepasste Pipeline bereitzustellen.

BlobChangeFeedClient(string, StorageSharedKeyCredential | AnonymousCredential | TokenCredential, StoragePipelineOptions, BlobChangeFeedClientOptions)

Erstellt eine Instanz von BlobChangeFeedClient.

new BlobChangeFeedClient(url: string, credential?: StorageSharedKeyCredential | AnonymousCredential | TokenCredential, options?: StoragePipelineOptions, changeFeedClientOptions?: BlobChangeFeedClientOptions)

Parameter

url

string

Eine Clientzeichenfolge, die auf den Azure Storage-BLOB-Dienst verweist, z. B. "https://myaccount.blob.core.windows.net". Sie können eine SAS anfügen, wenn Anonyme Anmeldeinformationen verwendet werden, z. B. "https://myaccount.blob.core.windows.net?sasString".

credential

StorageSharedKeyCredential | AnonymousCredential | TokenCredential

Wie anonyme Anmeldeinformationen, StorageSharedKeyCredential oder anmeldeinformationen aus dem @azure/identity-Paket zum Authentifizieren von Anforderungen an den Dienst. Sie können auch ein Objekt bereitstellen, das die TokenCredential-Schnittstelle implementiert. Wenn nicht angegeben, wird AnonymousCredential verwendet.

options
StoragePipelineOptions

Wahlfrei. Optionen zum Konfigurieren der HTTP-Pipeline.

Beispiel für die Verwendung von DefaultAzureCredential aus @azure/identity:

const account = "<storage account name>";

const defaultAzureCredential = new DefaultAzureCredential();

const blobChangeFeedClient = new BlobChangeFeedClient(
  `https://${account}.blob.core.windows.net`,
  defaultAzureCredential
);

Beispiel für die Verwendung eines Kontonamens/Schlüssels:

const account = "<storage account name>"
const sharedKeyCredential = new StorageSharedKeyCredential(account, "<account key>");

const blobChangeFeedClient = new BlobChangeFeedClient(
  `https://${account}.blob.core.windows.net`,
  sharedKeyCredential
);
changeFeedClientOptions
BlobChangeFeedClientOptions

Details zur Methode

fromConnectionString(string, StoragePipelineOptions, BlobChangeFeedClientOptions)

Erstellt eine Instanz von BlobChangeFeedClient aus verbindungszeichenfolge.

static function fromConnectionString(connectionString: string, options?: StoragePipelineOptions, changeFeedClientOptions?: BlobChangeFeedClientOptions): BlobChangeFeedClient

Parameter

connectionString

string

Kontoverbindungszeichenfolge oder SAS-Verbindungszeichenfolge eines Azure-Speicherkontos. [ Hinweis : Kontoverbindungszeichenfolge kann nur in NODE.JS Laufzeit verwendet werden. ] Beispiel für kontoverbindungszeichenfolge - beispiel für DefaultEndpointsProtocol=https;AccountName=myaccount;AccountKey=accountKey;EndpointSuffix=core.windows.net SAS-Verbindungszeichenfolge - BlobEndpoint=https://myaccount.blob.core.windows.net/;QueueEndpoint=https://myaccount.queue.core.windows.net/;FileEndpoint=https://myaccount.file.core.windows.net/;TableEndpoint=https://myaccount.table.core.windows.net/;SharedAccessSignature=sasString

options
StoragePipelineOptions

Wahlfrei. Optionen zum Konfigurieren der HTTP-Pipeline.

changeFeedClientOptions
BlobChangeFeedClientOptions

Gibt zurück

listChanges(BlobChangeFeedListChangesOptions)

Gibt einen asynchronen iterierbaren Iterator zurück, um alle Änderungsfeedereignisse im angegebenen Konto auflisten zu können.

.byPage() gibt einen asynchronen iterablen Iterator zurück, um die Änderungsfeedereignisse auf Seiten auflisten zu können.

Beispiel mit for await Syntax:

let i = 1;
for await (const event of blobChangeFeedClient.listChanges()) {
  console.log(`Event ${i++}, type: ${event.eventType}`);
}

Beispiel für die Verwendung von iter.next():

let i = 1;
const iter = blobChangeFeedClient.listChanges();
let eventItem = await iter.next();
while (!eventItem.done) {
  console.log(`Event ${i++}, type: ${eventItem.eventType}`);
  eventItem = await iter.next();
}

Beispiel für die Verwendung von byPage():

// passing optional maxPageSize in the page settings
let i = 1;
for await (const eventPage of blobChangeFeedClient.listChanges().byPage({ maxPageSize: 20 })) {
  if (eventPage.events) {
    for (const event of eventPage.events) {
      console.log(`Event ${i++}, type: ${event.eventType}`);
    }
  }
}

Beispiel für das Paging mit einer Markierung:

let i = 1;
let iterator = blobChangeFeedClient.listChanges().byPage({ maxPageSize: 2 });
let eventPage = (await iterator.next()).value;

if (eventPage.events) {
  for (const container of eventPage.events) {
    console.log(`Event ${i++}, type: ${event.eventType}`);
  }
}

// Gets next marker
let marker = eventPage.continuationToken;
// Passing next marker as continuationToken
iterator = blobChangeFeedClient
  .listChanges()
  .byPage({ continuationToken: marker, maxPageSize: 10 });
eventPage = (await iterator.next()).value;

if (eventPage.events) {
  for (const container of eventPage.events) {
     console.log(`Event ${i++}, type: ${event.eventType}`);
  }
}
function listChanges(options?: BlobChangeFeedListChangesOptions): PagedAsyncIterableIterator<BlobChangeFeedEvent, BlobChangeFeedEventPage, PageSettings>

Parameter

options
BlobChangeFeedListChangesOptions

Optionen zum Auflisten von Feed-Änderungsereignissen.

Gibt zurück

Ein asyncIterableIterator, der paging unterstützt.