You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/cosmos-db/nosql/change-feed-processor.md
+94Lines changed: 94 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -73,6 +73,57 @@ Afterward, you define the compute instance name or unique identifier by using `W
73
73
74
74
Calling `Build` gives you the processor instance that you can start by calling `StartAsync`.
75
75
76
+
> [!IMPORTANT]
77
+
> When creating the `CosmosClient` for both the feed and lease containers, and initializing a new change feed processor workload:
78
+
>
79
+
> **Use a global endpoint**
80
+
>
81
+
> - Always specify a global endpoint (for example, `contoso.documents.azure.com`) rather than a regional endpoint (for example, `contoso-westus.documents.azure.com`).
82
+
>
83
+
> **Switch regions using ApplicationRegion or ApplicationPreferredRegions**
84
+
>
85
+
> - To redirect change feed traffic between regions, rely on the `ApplicationRegion` or `ApplicationPreferredRegions` property.
86
+
> - Change Feed Processor creates lease documents that are scoped to the configured endpoint, hence changing the endpoints results in the creation of new independent lease documents.
87
+
>
88
+
> **✅ Do this - Use global endpoint with ApplicationRegion:**
89
+
>
90
+
> ```csharp
91
+
>CosmosClientclient=newCosmosClient(
92
+
>"https://contoso.documents.azure.com:443/", // Global endpoint
93
+
>"<account-key>",
94
+
>newCosmosClientOptions()
95
+
> {
96
+
>ApplicationRegion=Regions.WestUS2// Specify region here
>**Avoidasynchronousprocessingindelegate methods**: When using asynchronous APIs within your `handleChanges()` delegate method, beawarethatthechangefeedprocessormaycheckpointtheleasebeforeallasynchronousoperationscomplete. Thiscanleadtomissedeventsiftheapplicationexperiencesissuesduringrecovery. Considerusingsynchronousprocessingorimplementpropercompletiontrackingbeforeallowingthedelegatetoreturn.
78
129
@@ -179,6 +230,49 @@ In either change feed mode, you can assign it to `changeFeedProcessorInstance` a
>**Avoidasynchronousprocessingindelegate methods**: When using asynchronous APIs within your `handleChanges()` delegate method, beawarethatthechangefeedprocessormaycheckpointtheleasebeforeallasynchronousoperationscomplete. Thiscanleadtomissedeventsiftheapplicationexperiencesissuesduringrecovery. Considerusingsynchronousprocessingorimplementpropercompletiontrackingbeforeallowingthedelegatetoreturn.
0 commit comments