Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Preview] Change Feed: Adds Full Fidelity support #2122

Merged
merged 13 commits into from
Feb 2, 2021

Conversation

ealsur
Copy link
Member

@ealsur ealsur commented Jan 13, 2021

Description

This PR enables the APIs to support Change Feed in Full Fidelity mode. Building on top of the Retention API exposed at #2020 and #2109, once a container has been created with Change Feed retention, Change Feed iterators can be created with Full Fidelity.

Full Fidelity Change Feed exposes creates, replaces, delete operations, including metadata.

The PR exposes a new ChangeFeedMode as a required parameter to initiate any Change Feed iterator. This prompts the user to make a conscious choice of the mode they want to use.

Current Change Feed (the one available until now) is called ChangeFeedMode.Incremental, while the new one is called ChangeFeedMode.FullFidelity.

Creating a container with retention

ContainerProperties containerProperties = new ContainerProperties("myContainer", "/pk");
containerProperties.ChangeFeedPolicy.FullFidelityRetention = TimeSpan.FromMinutes(5);

CosmosContainerResponse containerCreateResponse = await database.CreateContainerAsync(containerProperties, 5000);

Starting an incremental Change Feed (normal Change Feed)

FeedIterator feedIterator = container.GetChangeFeedStreamIterator(
        ChangeFeedStartFrom.Now(),
        ChangeFeedMode.Incremental)

or

FeedIterator<MyType> feedIterator = container.GetChangeFeedIterator<MyType>(
        ChangeFeedStartFrom.Now(),
        ChangeFeedMode.Incremental)

Starting a Change Feed with Full Fidelity

FeedIterator feedIterator = container.GetChangeFeedStreamIterator(
        ChangeFeedStartFrom.Now(),
        ChangeFeedMode.FullFidelity)

or

FeedIterator<MyType> feedIterator = container.GetChangeFeedIterator<MyType>(
        ChangeFeedStartFrom.Now(),
        ChangeFeedMode.FullFidelity)

The document payload available during Full Fidelity responses includes the _metadata attribute which contains the context information (like operationType).

Type of change

  • New feature (non-breaking change which adds functionality)

j82w
j82w previously approved these changes Jan 19, 2021
Copy link
Member

@FabianMeiswinkel FabianMeiswinkel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM Matias - thanks!

Copy link
Member

@FabianMeiswinkel FabianMeiswinkel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ChangeFeed feature-request New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants