BlobChangeFeedClient class

BlobChangeFeedClient.

Costruttori

BlobChangeFeedClient(string, Pipeline)

Crea un'istanza di BlobChangeFeedClient.

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

Crea un'istanza di BlobChangeFeedClient.

Metodi

fromConnectionString(string, StoragePipelineOptions)

Crea un'istanza di BlobChangeFeedClient dalla stringa di connessione.

listChanges(BlobChangeFeedListChangesOptions)

Restituisce un iteratore iteratore asincrono per elencare tutti gli eventi del feed di modifiche nell'account specificato. .byPage() restituisce un iteratore iteratore asincrono per elencare gli eventi del feed di modifiche nelle pagine.

Esempio di utilizzo della sintassi for await:

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

Esempio di utilizzo di 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();
}

Esempio di utilizzo di 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}`);
    }
  }
}

Esempio di utilizzo del paging con un marcatore:

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}`);
  }
}

Dettagli costruttore

BlobChangeFeedClient(string, Pipeline)

Crea un'istanza di BlobChangeFeedClient.

new BlobChangeFeedClient(url: string, pipeline: Pipeline)

Parametri

url

string

Stringa client che punta al servizio BLOB di Archiviazione di Azure, ad esempio "https://myaccount.blob.core.windows.net". È possibile aggiungere una firma di accesso condiviso se si usa AnonymousCredential, ad esempio "https://myaccount.blob.core.windows.net?sasString".

pipeline

Pipeline

Chiamare newPipeline() per creare una pipeline predefinita o fornire una pipeline personalizzata.

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

Crea un'istanza di BlobChangeFeedClient.

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

Parametri

url

string

Stringa client che punta al servizio BLOB di Archiviazione di Azure, ad esempio "https://myaccount.blob.core.windows.net". È possibile aggiungere una firma di accesso condiviso se si usa AnonymousCredential, ad esempio "https://myaccount.blob.core.windows.net?sasString".

credential

StorageSharedKeyCredential | AnonymousCredential | TokenCredential

Ad esempio AnonymousCredential, StorageSharedKeyCredential o qualsiasi credenziale del pacchetto @azure/identity per autenticare le richieste al servizio. È anche possibile fornire un oggetto che implementa l'interfaccia TokenCredential. Se non specificato, viene utilizzato AnonymousCredential.

options

StoragePipelineOptions

Dettagli metodo

fromConnectionString(string, StoragePipelineOptions)

Crea un'istanza di BlobChangeFeedClient dalla stringa di connessione.

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

Parametri

connectionString

string

Stringa di connessione dell'account o stringa di connessione sas di un account di archiviazione di Azure. [ Nota: la stringa di connessione dell'account può essere usata solo in NODE.JS runtime. ] Esempio di stringa di connessione dell'account - Esempio di stringa di connessione sas DefaultEndpointsProtocol=https;AccountName=myaccount;AccountKey=accountKey;EndpointSuffix=core.windows.net - 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

Restituisce

listChanges(BlobChangeFeedListChangesOptions)

Restituisce un iteratore iteratore asincrono per elencare tutti gli eventi del feed di modifiche nell'account specificato. .byPage() restituisce un iteratore iteratore asincrono per elencare gli eventi del feed di modifiche nelle pagine.

Esempio di utilizzo della sintassi for await:

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

Esempio di utilizzo di 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();
}

Esempio di utilizzo di 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}`);
    }
  }
}

Esempio di utilizzo del paging con un marcatore:

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)

Parametri

Restituisce

PagedAsyncIterableIterator<BlobChangeFeedEvent, BlobChangeFeedEventPage>

AsyncIterableIterator che supporta il paging.