What are the components of the change feed processor?

Monitored Container

Lease Container

Host

Delegate

What is the use of monitored container?

Monitored container is monitored for any insert or update operations. These changes are then reflected in the feed.

What is the use of lease container?

The lease container serves as a storage mechanism to manage state across multiple change feed consumers(clients)

What is a host?

The host is a client application instance that listens for and reacts to changes from the change feed

What is a delegate?

The delegate is a code within the client application that will implement business logic for each batch of changes.

What is the first step towards creating the change feed processor?

Prior to using the change feed processor, you should create a lease container that will reference when configuring the processor.

What should be the type of delegate?

For the change feed processor, the library expects a delegate of type ChangesHandler<> that takes generic type to represent your serialized individual items. You could create a method named HandleChangesAsync with the same method signature as the delegate in a verbose syntax. Once this method is created, a variable of type ChangesHandler<> is created.

What does a delegate include?

The delegate includes two parameters, a read only list of changes and a cancellation token.

What is a delegate in C#?

In C#, a delegate is a special type of variable or member that references a method with a specific parameter list and a return type.

How is a change feed processor created?

A change feed processor is created using the following steps –

  1. Get the processor builder from the monitored container varibale
  2. Use the builder to build out the processor by specifying the delegate, processor name, lease container, host and instance name.
  3. Start processor

Which method is used to create a builder?

You can use the GetChangeFeedProcessorBuilder method from a container instance to build a builder.

What are the various methods of the builder –

WithInstanceName – name of a host instance

WithStarTime – set the pointer in time to start looking for changes after

WithLeaseContainer – configures the lease container

WithErrorNotification – assigns a delegate to handle errors during execution

WithMaxItems – quantifies the max number of items in each batch

WithPollInterval – set the delay when the processor will poll the change feed for new change.

Which methods are used to run the change feed processor?

StartAsync and StopAsync

What is the need of an estimator?

Identifying if your change feed processor needs to scale out can be difficult and requires an estimator.

What is a change feed estimator?

The change feed estimator is a sidecar feature to the processor that measures the number of changes that are pending to be read by the processor at any time.

How is a change feed estimator implemented?

A delegate created is implemented to use the type ChangesEstimationHandler to handle each time the estimator polls the change feed to see how many changes have not been processed yet.

Which method of the Container class is used to create a new change feed estimator? 

GetChangeFeedEstimatorBuilder

Which method of the ChangeFeedProcessor class should you invoke to start consuming changes from the change feed?

StartAsync

Which method is used to build a builder?

GetChangeFeedProcessorBuilder. In this method you specify the processor and the delegate.

What is used to set the delay in changes?

WithPollInterval sets the delay when the processor will poll the change feed for new changes.

What are azure functions?

Azure function is a service that offers serverless blocks of code that run logic on demand.

How are functions started?

Each functions starts with some external event called trigger, that indicates that the function should start.

What bindings are present in azure functions?

A function contains an input binding that provides more data after the function has already been triggered and an output binding indicating where the function should send its response.

These bindings only support NoSQL API.

How are functions modified to use azure cosmos db?

Create an app setting in the function instance with the connection string of the azure cosmos DB account.

Where are the bindings for a function stored?

The function.json file is the configuration file for all bindings within a function. The file contains a JSON object with a property named bindings. The bindings objects is an array of trigger, input and output bindings for that particular function.

What is the type of the following –

trigger – cosmosDbTrigger

input/output binding – cosmosDb

What is the use of createLeaseCollectionIfNotExists?

a boolean value to indicate if the azure functions run time should create the lease container if it does not already exists.

What are the types of input binding?

There are two types of input binding : input bindings that perform a point read and lookup a single item

Input binding that performs a single SQL query and returns multiple items

For performing a point read input binding what are required?

id,partitionkey

What are the types of ouput bindings?

Use the output binding to write a single item to a container; use the ouput binding to write multiple items to a container.

Where are the list of current changes stored?

The code for a change feed trigger includes a method parameter of type IReadOnlyList<Document> that has an enumerated list of the current batch of changes. The name of the method parameter must match the value provided in the binding configuration of the name property.

To what is the item typed to, in case the type of item is not defined by the coder, in case of point read input binding?

Document

What do input bindings with sql query require?

Input bindings with SQL query require a method parameter of type IEnumerable<>. This type is used as a generic parameter and can be a Document or a type specified by the user in C#.

You’re creating an Azure Function to monitor a container for new items and changes to existing items. Which type of binding should you use to start executing the function where there are changes to items?

Trigger binding

You have an output binding configured for Azure Cosmos DB for NoSQL named items. You would like to add multiple items to a container using this binding. Which function method parameter should you use to add more than one item to a container?

IAsyncCollector<Product> items

When configuring an Azure Cosmos DB for NoSQL trigger, which of the following settings would be valid?

ย 

set the direction to in

How are multiple items added to a container?

Using the addsync method in output binding

How is the output binding configured when writing a single item?

the ouput binding corresponding parameter should be configured to out parameter and can be any type of C#.

What is azure cognitive search?

Azure Cognitive Search is a cloud-native search service that provides an expanded set of query functionality over a large variety and volume of data. A search service is ideal for scenarios where your developer team would like to implement search-specific features such as filters, faceting, autocomplete, and synonym matching without the complexity of trying to implement these features directly in the database source

What is Azure Cognitive Search comprised of?

  1. Index that contain JSON documents that are searchable
  2. Indexers to crawl data from various data sources and insert them to indexes
  3. Data Sources that connect Azure Cognitive Search to various data platforms.

How does azure cognitive search works in case of Azure Cosmos DB for NoSQL?

You can configure a container as a data source, create a query and frequency that the indexer will used to crawl data, and create a target index where the resulting searchable JSON documents are stored.

What are the necessary requirements when creating an index for azure congnitive search?

name and key. the key refers to a unique identifier field for each JSON document in the index.

What features are available for an index when searching/

Retrievable – configures the field to be projected in search result sets

filterable – Accepts OData-style filtering on the field

Sortable – Enables sorting using the field

Facetable – allows fields to be dynamically aggregated and sorted

Searchable allows search queries to match terms in the field

What is the use of schedule in the indexer?

The schedule determines how often the indexer will run to pull data from the data source and populate the index with JSON documents.

To implement the change detection policy in azure cognitive search, how is the result sorted?

The result is sorted using the _ts field.

What is the high watermark field in the default change detection query ?

The high watermark field comes from a built in change detection policy that attempts to identify whether an item has changed or not.

What happens if an item is deleted from azure cosmos db?

If an item is deleted from a container in Azure Cosmos DB for NoSQL , that item may not be deleted from the index in azure cognitive search. to enable tracking of deleted items, you must configure a policy to track when an item is deleted.

How can we track if the value for a column has been deleted?

Using the soft-delete policy, the softDeleteColumnName for the data source (Azure Cosmos DB for NoSQL) would be configured as _isDeleted. The softDeleteMarkerValue would then be set to true. For example –

{
“id”: “E08E4507-9666-411B-AAC4-519C00596B0A”,
“categoryId”: “86F3CBAB-97A7-4D01-BABB-ADEFFFAED6B4”,
“sku”: “TI-R092”,
“name”: “LL Road Tire”,
“_isDeleted”: true
}

To enable the ability to index changes in Azure Cosmos DB for NoSQL items, which field should you include in the data source’s SQL query?

_ts

Your Azure Cosmos DB for NoSQL solution regularly uses a time-to-live value to automatically delete items after a set amount of time. Which strategy should you use to ensure that the deleted items are also deleted in the search index?

ย 

configure a soft delete policy with a tracked column and value

Foolishly Yours,

AvantikaTanubhrt

Happy Learning ๐Ÿ™‚

Leave a comment