-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Allowing customers to wrap CosmosAsyncContainer #43724
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
Allowing customers to wrap CosmosAsyncContainer #43724
Conversation
|
API change check APIView has identified API level changes in this PR and created following API reviews. |
|
This is a good PR to open up the SDK a lot more in an easy to understand way.
|
Regarding #1 - the public API for readAllItems is meant to read all documents of a logical partition - this one can also be extended - azure-sdk-for-java/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/CosmosAsyncContainer.java Lines 1578 to 1674 in e948b62
Regarding #2 - ACK - this is true and it is (an intentional) limitation of CosmosPagedFlux - let's go through the concrete use cases to see whether/how we can unblock them by allowing public CosmosPagedFlux overloads or factory methods Regarding #3 - Correct - pipelining would be needed in this case - but I don't quite see why that is a problem. |
on #1 I aggree - not an issue |
|
Hi @FabianMeiswinkel. Thank you for your interest in helping to improve the Azure SDK experience and for your contribution. We've noticed that there hasn't been recent engagement on this pull request. If this is still an active work stream, please let us know by pushing some changes or leaving a comment. Otherwise, we'll close this out in 7 days. |
|
keep this active please |
Gueorgi
left a comment
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.
tvaron3
left a comment
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.
LGTM
sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/CosmosAsyncDatabase.java
Outdated
Show resolved
Hide resolved
sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/CosmosClient.java
Outdated
Show resolved
Hide resolved
sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/CosmosClientBuilderTest.java
Show resolved
Hide resolved
…syncDatabase.java Co-authored-by: Tomas Varon <[email protected]>
kushagraThapar
left a comment
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.
LGTM except few nits.
sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/CosmosAsyncClient.java
Outdated
Show resolved
Hide resolved
sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/CosmosAsyncDatabase.java
Show resolved
Hide resolved
…/FabianMeiswinkel/azure-sdk-for-java into users/fabianm/ContainerExtension
This reverts commit d54c91b.
This reverts commit 4f280d0.
Description
This PR adds a protected ctor for
CosmosAsyncContainerto allow extending Container - for example to add custom diagnostics, error handling, retry policies or addiitonal validation - like disallowing certain query functionality etc.The
CosmosAsyncContainerhas several non-final methods already - but there was no public/protected ctor - this was intentional, because the business logic in theCosmosAsyncContainerreally does not allow for artificial extensions - like it won't make much sense to try to inject a different store than Cosmso DB because the logc for metrics, diagnostics and even the PagedIterator returned from query etc. is intentionally tight to Cosmos DB.There have been a few customer reports thought for limited extensibility - for testing mocking, but also to add some shared custom diagnostics and some validations to prevent application teams to violate against best practices (preventing cross-partition queries, disabling scan in query etc.)
So, this PR opens the extensibility in CosmosAsyncContainer a bit more - but since the only protected ctor still requires a CosmosAsnycContainer for the actual implementations it still only allows extensions to wrap around the original Container implementation. This PR is intentionally not trying to extend extensibility to support generic stores etc.
There are two options on how to inject custom containers.
This PR also adds a new static factory method that allows creating a new CosmosPagedFlux based off of a list of items.
All SDK Contribution checklist:
General Guidelines and Best Practices
Testing Guidelines