BlobChangeFeedClient class

Constructors

BlobChangeFeedClient(string, Pipeline)

Creates an instance of BlobChangeFeedClient.

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

Creates an instance of BlobChangeFeedClient.

Methods

fromConnectionString(string, StoragePipelineOptions, BlobChangeFeedClientOptions)

Creates an instance of BlobChangeFeedClient from connection string.

listChanges(BlobChangeFeedListChangesOptions)

Returns an async iterable iterator to list all the change feed events in the specified account.

.byPage() returns an async iterable iterator to list the change feed events in pages.

Example using for await syntax:

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

Example using 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();
}

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

Example using paging with a marker:

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

Constructor Details

BlobChangeFeedClient(string, Pipeline)

Creates an instance of BlobChangeFeedClient.

new BlobChangeFeedClient(url: string, pipeline: Pipeline)

Parameters

url

string

A Client string pointing to Azure Storage blob service, such as "https://myaccount.blob.core.windows.net". You can append a SAS if using AnonymousCredential, such as "https://myaccount.blob.core.windows.net?sasString".

pipeline
Pipeline

Call newPipeline() to create a default pipeline, or provide a customized pipeline.

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

Creates an instance of BlobChangeFeedClient.

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

Parameters

url

string

A Client string pointing to Azure Storage blob service, such as "https://myaccount.blob.core.windows.net". You can append a SAS if using AnonymousCredential, such as "https://myaccount.blob.core.windows.net?sasString".

credential

StorageSharedKeyCredential | AnonymousCredential | TokenCredential

Such as AnonymousCredential, StorageSharedKeyCredential or any credential from the @azure/identity package to authenticate requests to the service. You can also provide an object that implements the TokenCredential interface. If not specified, AnonymousCredential is used.

options
StoragePipelineOptions

Optional. Options to configure the HTTP pipeline.

Example using DefaultAzureCredential from @azure/identity:

const account = "<storage account name>";

const defaultAzureCredential = new DefaultAzureCredential();

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

Example using an account name/key:

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

Method Details

fromConnectionString(string, StoragePipelineOptions, BlobChangeFeedClientOptions)

Creates an instance of BlobChangeFeedClient from connection string.

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

Parameters

connectionString

string

Account connection string or a SAS connection string of an Azure storage account. [ Note - Account connection string can only be used in NODE.JS runtime. ] Account connection string example - DefaultEndpointsProtocol=https;AccountName=myaccount;AccountKey=accountKey;EndpointSuffix=core.windows.net SAS connection string example - 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

Optional. Options to configure the HTTP pipeline.

changeFeedClientOptions
BlobChangeFeedClientOptions

Returns

listChanges(BlobChangeFeedListChangesOptions)

Returns an async iterable iterator to list all the change feed events in the specified account.

.byPage() returns an async iterable iterator to list the change feed events in pages.

Example using for await syntax:

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

Example using 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();
}

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

Example using paging with a marker:

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>

Parameters

options
BlobChangeFeedListChangesOptions

Options to list change feed events.

Returns

An asyncIterableIterator that supports paging.