-
Notifications
You must be signed in to change notification settings - Fork 494
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
Change Feed Processor: Adds detailed delegate context , stream, and manual checkpointing support #2650
Conversation
/// <param name="changes">The changes that happened.</param> | ||
/// <param name="cancellationToken">A cancellation token representing the current cancellation status of the <see cref="ChangeFeedProcessor"/> instance.</param> | ||
/// <returns>A <see cref="Task"/> representing the asynchronous operation that is going to be done with the changes.</returns> | ||
public delegate Task ChangeFeedHandler<T>( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In v4 SDK changefeed should be put under it's own object like Scripts to keep all the change feed APIs together while reducing the container object bloating.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unsure, scripts namespace is meant for server side scripting (SPROC, Trigger, CRUD etc...).
Sure lets track it for discussion.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm meant have a container.ChangeFeed.GetProcessorBuilderWithManualCheckpoint. Then have all the methods and delegates off of the container.ChangeFeed object. That way all the changefeed methods are grouped together.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, grouping could allow them to live in a ChangeFeed namespace maybe
After 4 months on preview (#2331) this PR moves to GA the new delegates and stream support for Change Feed Processor.
New delegates
We previously had a single delegate to process changes:
In order to address the requests in the linked incidents, we are introducing 4 new delegates:
Container API changes
Stream support
Stream APIs allow customers to send the data to other components without serializing it on the Change Feed Processor, this is possible through 2 of the new delegates, the most common one that will handle checkpointing for the user:
And one where the use can manage checkpoint themselves:
How to leverage manual checkpoint?
There isn't any extra configuration required on the
ChangeFeedProcessorBuilder
other than using the delegate that exposes the checkpoint logic. Choosing this delegate is an implicit opt-in on the logic.This enables users to decide when to checkpoint the progress of a lease. Some users decide to do buffering of changes and once the buffer commits (processes all the changes), then they decide to checkpoint.
Any of the 2 delegates that expose the checkpoint mechanism allows for this, via the call to
checkpointAsync
, like so:What is there in the context?
The context includes information related to changes delivered on the delegate, it includes the identifier of which lease they belong to (this is useful paired with the
Container.ChangeFeedEstimator
for monitoring). the Headers (that expose RU consumption and SessionToken for extending the session to other components), and the Diagnostics.Type of change
cc @bartelink