Skip to content

Commit 02630cf

Browse files
committed
Sneha review/edits
1 parent b3b97ad commit 02630cf

26 files changed

+320
-307
lines changed
Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,37 @@
11
---
22
title: Working with Azure Cosmos DB accounts
33
description: This article describes how create and use Azure Cosmos DB accounts
4-
services: cosmos-db
5-
author: dharmas-cosmos
4+
author: dharmas
65

76
ms.service: cosmos-db
87
ms.topic: conceptual
98
ms.date: 11/08/2018
10-
ms.author: dharmas-cosmos
9+
ms.author: dharmas
1110
ms.reviewer: sngun
1211

1312
---
1413

1514
# Working with Azure Cosmos DB accounts
1615

17-
Azure Cosmos DB is a fully managed platform-as-a-service (PaaS). To begin using the Cosmos DB service, you need to start by creating a Cosmos account, using your Azure subscription. Your Cosmos account is given a unique DNS name, which you can manage using Azure CLI. For more information, see [how to manage your Cosmos account](manage-account.md).
16+
Azure Cosmos DB is a fully managed platform-as-a-service (PaaS). To begin using Azure Cosmos DB, you should initially create an Azure Cosmos DB account in your Azure subscription. Your Azure Cosmos DB account contains a unique DNS name and you can manage an account by using Azure portal, Azure CLI or by using different language-specific SDKs. For more information, see [how to manage your account](how-to-manage-database-account.md).
1817

19-
The Cosmos account is the fundamental unit of global distribution and high availability. For globally distributing your data and throughput across multiple Azure regions, you can add and remove Azure regions to your Cosmos account at any time. You can configure your Cosmos account to have either a single or multiple write regions. See [how to add and remove Azure regions to your Cosmos account](how-to-manage-database-account.md). You can configure the default consistency level on Cosmos account. For more information, see [Consistency levels](consistency-levels.md). Cosmos DB provides comprehensive SLAs encompassing throughput, latency at the 99th percentile, consistency, and high availability. For details, see [Cosmos DB SLAs](https://azure.microsoft.com/en-us/support/legal/sla/cosmos-db/v1_2/).
18+
The Azure Cosmos DB account is the fundamental unit of global distribution and high availability. For globally distributing your data and throughput across multiple Azure regions, you can add and remove Azure regions to your account at any time. You can configure your account to have either a single or multiple write regions. For more information, see [how to add and remove Azure regions to your Cosmos account](how-to-manage-database-account.md). You can configure the [default consistency](consistency-levels.md) level on Cosmos account. Cosmos DB provides comprehensive SLAs encompassing throughput, latency at the 99th percentile, consistency, and high availability. For more information, see [Azure Cosmos DB SLAs](https://azure.microsoft.com/en-us/support/legal/sla/cosmos-db/v1_2/).
2019

21-
To securely manage access to all the data managed within your Cosmos account, you can use the master keys associated with your Cosmos account. Usage of master keys is shown in [how to authorize requests using master keys and resource tokens](TBD). To further secure access to your data, you can configure a VNET service endpoint and IP-firewall on your Cosmos account. For more information, see [VNET and subnet access control for your Cosmos account](TBD) and [IP-firewall for your Cosmos account](TBD).
20+
To securely manage access to all the data within your Azure Cosmos DB account, you can use the master keys associated with your account. To learn more, see [how to authorize requests by using master keys and resource tokens](TBD) article. To further secure access to your data, you can configure a VNET service endpoint and IP-firewall on your Azure Cosmos account. For more information, see [VNET and subnet access control for your Cosmos account](how-to-configure-vnet-service-endpoint.md) and [IP-firewall for your Cosmos account](how-to-configure-firewall.md).
2221

23-
Currently, you can create at most 100 Cosmos accounts under an Azure subscription. A single Cosmos account can manage a virtually unlimited amount of data and provisioned throughput. To manage your data and provisioned throughput, you can create one or more Cosmos databases under your Cosmos account and within a database, you can create one or more Cosmos containers.
22+
Currently, you can create a maximum of 100 Azure Cosmos DB accounts under an Azure subscription. A single account can virtually manage unlimited amount of data and provisioned throughput. To manage your data and provisioned throughput, you can create one or more Azure Cosmos databases under your account and within that database, you can create one or more containers.
2423

25-
![Cosmos account](./media/account/hierarchy.png)
24+
![Hierarchy of a Cosmos DB account](./media/account-overview/hierarchy.png)
2625

27-
A Cosmos container is the fundamental unit of scalability. You can have a virtually unlimited amount of provisioned throughput (RU/s) and storage on a Cosmos container. Cosmos DB transparently partitions your container using the logical partition key you specify in order to elastically scale your provisioned throughput and storage. For more information, see [working with Cosmos containers and items](TBD).
26+
Azure Cosmos DB container is the fundamental unit of scalability. You can virtually have an unlimited provisioned throughput (RU/s) and storage on a container. Azure Cosmos DB transparently partitions your container using the logical partition key that you specify in order to elastically scale your provisioned throughput and storage. For more information, see [working with Azure Cosmos containers and items](databases-containers-items.md).
2827

2928
## Next steps
3029

31-
* [How-to manage your Cosmos account](manage-account.md)
30+
* [How-to manage your Cosmos account](how-to-manage-database-account.md)
3231
* [Global distribution](distribute-data-globally.md)
3332
* [Consistency levels](consistency-levels.md)
34-
* [Working with Cosmos containers and items](TBD)
35-
* [VNET service endpoint for your Cosmos account](TBD)
36-
* [IP-firewall for your Cosmos account](TBD)
33+
* [Working with Cosmos containers and items](databases-containers-items.md)
34+
* [VNET service endpoint for your Cosmos account](firewall-support.md)
35+
* [IP-firewall for your Cosmos account](vnet-service-endpoint.md)
3736
* [How-to add and remove Azure regions to your Cosmos account](how-to-manage-database-account.md)
3837
* [Cosmos DB SLAs](https://azure.microsoft.com/en-us/support/legal/sla/cosmos-db/v1_2/)

articles/cosmos-db/change-feed-functions.md

Lines changed: 17 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,64 +1,57 @@
11
---
2-
title: How to use change feed with Azure Functions
2+
title: How to use Azure Cosmos DB change feed with Azure Functions
33
description: Use Azure Cosmos DB change feed with Azure Functions
4-
keywords: change feed
5-
services: cosmos-db
64
author: rimman
7-
manager: kfile
85

96
ms.service: cosmos-db
10-
ms.devlang: dotnet
117
ms.topic: conceptual
128
ms.date: 11/06/2018
139
ms.author: rimman
1410

1511
---
16-
# How to use change feed with Azure Functions
12+
# How to use Azure Cosmos DB change feed with Azure Functions
1713

18-
If you're using Azure Functions, the simplest way to connect to change feed is to add an [Azure Cosmos DB trigger](https://docs.microsoft.com/azure/azure-functions/functions-bindings-cosmosdb-v2#trigger) to your Azure Functions app. When you create a Cosmos DB trigger in an Azure Functions app, you select the Cosmos container to connect to and the function is triggered whenever a change to the container is made.
14+
If you're using Azure Functions, the simplest way to connect to change feed is to add an [Azure Cosmos DB trigger](../azure-functions/functions-bindings-cosmosdb-v2.md#trigger) to your Azure Functions app. When you create a Cosmos DB trigger in an Azure Functions app, you select the Cosmos container to connect to and the function is triggered whenever you change something in the container.
1915

20-
Triggers can be created in the Azure Functions portal or in the Cosmos DB portal or programmatically. For more information, see [Serverless database computing using Azure Cosmos DB and Azure Functions](https://docs.microsoft.com/en-us/azure/cosmos-db/serverless-computing-database).
16+
Triggers can be created in the Azure Functions portal or in the Azure Cosmos DB portal or programmatically. For more information, see [serverless database computing using Azure Cosmos DB and Azure Functions](serverless-computing-database.md).
2117

2218
## How can I configure Azure functions to read from a particular region?
2319

24-
It is possible to define the [PreferredLocations](https://docs.microsoft.com/dotnet/api/microsoft.azure.documents.client.connectionpolicy.preferredlocations?view=azure-dotnet#Microsoft_Azure_Documents_Client_ConnectionPolicy_PreferredLocations) when using the Cosmos DB Trigger to specify a list of regions, just like you would do when customizing the ConnectionPolicy, to make the Trigger read from your preferred region(s). Ideally, you want to read from the closest region to where your Azure Functions are deployed.
20+
It is possible to define the [PreferredLocations](https://docs.microsoft.com/dotnet/api/microsoft.azure.documents.client.connectionpolicy.preferredlocations?view=azure-dotnet#Microsoft_Azure_Documents_Client_ConnectionPolicy_PreferredLocations) when using the Azure Cosmos DB trigger to specify a list of regions. It's same as you customize the ConnectionPolicy, to make the trigger read from your preferred regions. Ideally, you want to read from the closest region where your Azure Functions is deployed.
2521

2622
## What is the default size of batches in Azure Functions?
2723

28-
The default size is 100 items for every invocation of Azure Functions. However, this number is configurable within the function.json file. Here is complete [list of configuration options](https://docs.microsoft.com/azure/azure-functions/functions-bindings-cosmosdb-v2#trigger---configuration). If you are developing locally, update the application settings within the local.settings.json file.
24+
The default size is 100 items for every invocation of Azure Functions. However, this number is configurable within the function.json file. Here is complete [list of configuration options](../azure-functions/functions-bindings-cosmosdb-v2.md#trigger---configuration). If you are developing locally, update the application settings within the local.settings.json file.
2925

30-
## I am monitoring a container and reading its change feed, however I see I am not getting all the inserted document, some items are missing. What is going on here?
26+
## I am monitoring a container and reading its change feed, however I don't get all the inserted documents, some items are missing?
3127

32-
Please make sure that there is no other function reading the same container with the same lease container. It happened to me, and later I realized the missing documents are processed by my other Azure functions, which is also using the same lease.
28+
Make sure that there is no other Azure Function reading the same container with the same lease container. The missing documents are processed by the other Azure Functions that are also using the same lease.
3329

34-
Therefore, if you are creating multiple Azure Functions to read the same change feed then they must use different lease container or use the "leasePrefix" configuration to share the same container. However, when you use change feed processor library you can start multiple instances of your function and SDK will divide the documents between different instances automatically for you.
30+
Therefore, if you are creating multiple Azure Functions to read the same change feed, they must use different lease containers or use the "leasePrefix" configuration to share the same container. However, when you use change feed processor library you can start multiple instances of your Azure Function and the SDK will divide the documents between different instances automatically for you.
3531

36-
## A Cosmos item is updated every second, and I am not getting all the changes in Azure Functions listening to change feed. What is going on here?
32+
## Azure Cosmos item is updated every second, and I don't get all the changes in Azure Functions listening to change feed?
3733

38-
Azure Functions polls the change feed for changes continuously, with a maximum default delay of 5 seconds in case there are no changes pending to be read, that is, if there are changes pending after it triggers, it will read them right away, but if there are no pending changes, it will wait 5 seconds and poll for more changes.
34+
Azure Functions polls the change feed for changes continuously, with a maximum default delay of 5 seconds. If there are no pending changes to be read, or if there are changes pending after the trigger is applied, the function will read them right away. However, if there are no pending changes, the function will wait 5 seconds and poll for more changes.
3935

40-
If your document received multiple changes in the interval that took the Trigger to poll for new changes, you might receive the latest version of the document and not the intermediate.
36+
If your document receives multiple changes in the same interval that took the Trigger to poll for new changes, you might receive the latest version of the document and not the intermediate one.
4137

42-
If you want to go below 5 seconds, and want to poll change Feed every second, you can configure the polling time "feedPollDelay", see [the complete configuration](https://docs.microsoft.com/dotnet/api/microsoft.azure.documents.client.connectionpolicy.preferredlocations?view=azure-dotnet#Microsoft_Azure_Documents_Client_ConnectionPolicy_PreferredLocations). It is defined in milliseconds with a default of 5000. Below 1 second is possible but not advisable, as you will start burning more CPU.
38+
If you want to to poll change feed for less than 5 seconds, for example, for every second, you can configure the polling time "feedPollDelay", see [the complete configuration](https://docs.microsoft.com/dotnet/api/microsoft.azure.documents.client.connectionpolicy.preferredlocations?view=azure-dotnet#Microsoft_Azure_Documents_Client_ConnectionPolicy_PreferredLocations). It is defined in milliseconds with a default of 5000. Polling for less than 1 second is possible but it's not advised because you will start using more CPU memory.
4339

4440
## Can multiple Azure Functions read one container’s change feed?
4541

46-
Yes. Multiple Azure Functions can read the same container’s change feed. However, the Azure Functions need to have a separate “leaseCollectionPrefix” defined.
42+
Yes. Multiple Azure Functions can read the same container’s change feed. However, the Azure Functions needs to have a separate “leaseCollectionPrefix” defined.
4743

48-
## If I am processing change feed by using Azure Functions, say a batch of 10 documents, and I get an error at 7th Document. In that case the last three documents are not processed how can I start processing from the failed document (i.e, 7th document) in my next feed?
44+
## If I am processing change feed by using Azure Functions, in a batch of 10 documents, and I get an error at seventh Document. In that case the last three documents are not processed how can I start processing from the failed document (i.e, seventh document) in my next feed?
4945

5046
To handle the error, the recommended pattern is to wrap your code with try-catch block and, if you are iterating over the list of documents, wrap each iteration in its own try-catch block. Catch the error and put that document on a queue (dead-letter) and then define logic to deal with the documents that produced the error. With this method if you have a 200-document batch, and just one document failed, you do not have to throw away the whole batch.
5147

52-
In case of error you should not rewind the check point back to beginning else you will can keep getting those documents from change feed. Remember, change feed keeps the last final snap shot of the documents, because of this you may lose the previous snapshot on the document. change feed keeps only one last version of the document, and in between other processes can come and change the document.
48+
In case of error, you should not rewind the check point back to beginning else you will can keep getting those documents from change feed. Remember, change feed keeps the last final snap shot of the documents, because of this you may lose the previous snapshot on the document. change feed keeps only one last version of the document, and in between other processes can come and change the document.
5349

5450
As you keep fixing your code, you will soon find no documents on dead-letter queue. Azure Functions is automatically called by change feed system and check point is maintained internally by Azure Function. If you want to roll back the check point and control every aspect of it, you should consider using change feed Processor SDK.
5551

5652
## Are there any extra costs for using the Azure Cosmos DB Trigger?
5753

58-
The Cosmos DB Trigger leverages the Change Feed Processor library internally. As such, it requires an extra collection, called Leases collection, to maintain state and partial checkpoints. This state management is needed to be able to dynamically scale and continue in case you want to stop your Functions and continue processing at a later time. See [How to work with change feed processor library](change-feed-processor.md).
59-
60-
61-
54+
The Azure Cosmos DB Trigger leverages the Change Feed Processor library internally. As such, it requires an extra collection, called Leases collection, to maintain state and partial checkpoints. This state management is needed to be able to dynamically scale and continue in case you want to stop your Azure Functions and continue processing at a later time. To learn more, see [how to work with change feed processor library](change-feed-processor.md).
6255

6356
## Next steps
6457

0 commit comments

Comments
 (0)