K3 (lesson 3.6.4) explained the change feed in one paragraph: The default mode does not see deletions, the mode "all versions and deletes" does, and the change feed processor reads it in .NET. This lesson builds something with it: the activity feed of Kladde.Verlauf. Whoever creates or changes an appointment should see "appointment changed" in the feed, without the writing application knowing about it. The feed lives in the container events (key /officeId, /day, TTL 90 days, F-03), fed from appointments, with the lease container leases.
Not run against Azure. The code was compiled with Microsoft.Azure.Cosmos 3.64.0 and Newtonsoft.Json 13.0.4. Only the mapping of a change to an event, the consumer against an in-memory store and the reading of a deletion from JSON were run (Exercise 1). Processor, pull model and copy job ran neither against an account nor against the emulator; whether the emulator supports the change feed was not read (open). The behavior of the service comes from Microsoft Learn, read on the day of writing.
Two modes
| latest version | all versions and deletes | |
|---|---|---|
| Content | creates and changes; only the latest version per item | creates, changes and deletes, every intermediate version |
| Deletions | not in the feed (way out: delete flag on the item plus TTL) | in the feed, also expiry through TTL (with a flag) |
| Start | beginning, point in time, "now", saved state | only "now" or saved state |
| Retention | no fixed period | only within the period of continuous backup |
| Prerequisite | default, every account except Table and PostgreSQL | continuous backup (lesson 3.2), switch the feature on at the account (up to 30 minutes), NoSQL only, SDK from 3.60.0 |
| Operation type | none (_ts, _lsn in addition) |
create, replace, delete in the metadata |
Also, in the second mode according to Learn: Accounts with merged partitions (merge) are not supported; you do not get the previous version of an item; a deleted item delivers only metadata with id and key; items from a batch or bulk have the same change time, their order is not guaranteed (lesson 2.3). Learn's processor article calls the mode a preview for .NET, the article on the modes does not: Check the status on the day of your planning (open).
Decision for the activity feed. "Appointment created or changed" is satisfied by latest version, without continuous backup; since this mode does not know an operation type, every event is at first called "changed". "Appointment deleted" needs the second mode or a delete flag that the application sets before deleting through TTL. The Kladde starts with latest version and switches on the deletions as soon as the backup per lesson 3.2 is in place.