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

Handle ChangeFeedProcessorContext for full-fidelity changefeed. #36715

Merged
merged 45 commits into from
Sep 28, 2023

Conversation

jeet1995
Copy link
Member

@jeet1995 jeet1995 commented Sep 12, 2023

The PR introduces public API changes to handle a ChangeFeedProcessorContext along with the change feed batch of documents.

ChangeFeedProcessorBuilder#handleAllVersionsAndDeletesChanges

  • API contract
public ChangeFeedProcessorBuilder handleAllVersionsAndDeletesChanges(BiConsumer<List<ChangeFeedProcessorItem>, ChangeFeedProcessorContext> biConsumer);
  • Using the API
// initialize the feedContainer & leaseContainer
CosmosAsyncContainer feedContainer, leaseContainer;
        
// build changeFeedProcessorOptions as needed
ChangeFeedProcessorOptions changeFeedProcessorOptions;

ChangeFeedProcessor changeFeedProcessor = new ChangeFeedProcessorBuilder()
    .hostName(hostName)
    .handleAllVersionsAndDeletesChanges((docs, context) -> {
         for (ChangeFeedProcessorItem doc : docs) {
              // process docs based on business logic
         }
         String leaseToken = context.getLeaseToken();
         // process leaseToken based on business logic
    })
    .feedContainer(feedContainer)
    .leaseContainer(leaseContainer)
    .options(changeFeedProcessorOptions)
    .buildChangeFeedProcessor();

@azure-sdk
Copy link
Collaborator

API change check

APIView has identified API level changes in this PR and created following API reviews.

azure-cosmos

@jeet1995 jeet1995 changed the title [No review]: Handle ChangeFeedProcessorContext. Handle ChangeFeedProcessorContext for full-fidelity changefeed. Sep 20, 2023
@jeet1995 jeet1995 marked this pull request as ready for review September 20, 2023 23:03
…dCFPContext

# Conflicts:
#	sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/rx/changefeed/epkversion/FullFidelityChangeFeedProcessorTest.java
#	sdk/cosmos/azure-cosmos/CHANGELOG.md
@jeet1995
Copy link
Member Author

/azp run java - cosmos - tests

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@jeet1995
Copy link
Member Author

/azp run java - cosmos - tests

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@jeet1995
Copy link
Member Author

/azp run java - cosmos - tests

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@jeet1995
Copy link
Member Author

/azp run java - cosmos - tests

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

Copy link
Member

@kushagraThapar kushagraThapar left a comment

Choose a reason for hiding this comment

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

LGTM, great work @jeet1995 , thank you!

@jeet1995
Copy link
Member Author

/azp run java - cosmos - tests

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@jeet1995
Copy link
Member Author

/check-enforcer override

@jeet1995
Copy link
Member Author

There is a flakiness issue with a few tests in ProactiveConnectionManagementTests and ClientMetricsTests - fixes are being tracked

@jeet1995 jeet1995 merged commit 59f37b6 into Azure:main Sep 28, 2023
56 of 58 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants