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

Enhancing CosmosTemplate to Support Multi-Tenancy at a DB Level #32516

Merged
merged 25 commits into from
Dec 21, 2022

Conversation

trande4884
Copy link
Member

@trande4884 trande4884 commented Dec 8, 2022

Description

This PR adds support for multi-tenancy at a DB level via the CosmosFactory. There is a test case added which shows how the user can extend CosmosFactory and override getDatabaseName() in order to dynamically set the DB being used by CosmosTemplate and repositories when making calls. Integration test coverage was added for this new feature.

All SDK Contribution checklist:

  • The pull request does not introduce [breaking changes]
  • CHANGELOG is updated for new features, bug fixes or other significant changes.
  • I have read the contribution guidelines.

General Guidelines and Best Practices

  • Title of the pull request is clear and informative.
  • There are a small number of commits, each of which have an informative message. This means that previously merged commits do not appear in the history of the PR. For more information on cleaning up the commits in your PR, see this page.

Testing Guidelines

  • Pull request includes test coverage for the included changes.

@ghost ghost added Cosmos azure-spring All azure-spring related issues labels Dec 8, 2022
…late. With this updated CosmosFactory so that it can be extended to achieve Multi-Tenancy at the database level. The test case was updated also.
…iveCosmosTemplate and adding sample to ReadMe.
@trande4884
Copy link
Member Author

/azp run java - cosmos - tests

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@trande4884
Copy link
Member Author

/azp run java - cosmos - tests

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@trande4884
Copy link
Member Author

/azp run java - cosmos - tests

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@trande4884
Copy link
Member Author

/azp run java - cosmos - tests

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@trande4884
Copy link
Member Author

/azp run java - cosmos - tests

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@trande4884
Copy link
Member Author

/check-enforcer override

@trande4884 trande4884 merged commit c0d9bde into Azure:main Dec 21, 2022
billwert pushed a commit to billwert/azure-sdk-for-java that referenced this pull request Jan 4, 2023
…e#32516)

* Proof of concept that we can write to two databases from the same session.

* Improving the changes to CosmosTemplate and the test case.

* Moving default setNameAndCreateDatabase() logic into CosmosTemplate.

* Improving unit test.

* Changing function name to be a more accurate description of the functionality.

* Updating changelog

* Removing unused imports.

* Code cleanup.

* Refactoring CosmosTemplate to now store the CosmosFactory on the template. With this updated CosmosFactory so that it can be extended to achieve Multi-Tenancy at the database level. The test case was updated also.

* Updating changelog.

* Making the requested updates in the PR. Adding CosmosFactory to ReactiveCosmosTemplate and adding sample to ReadMe.

* Making updates for PR comments.

* Fixing updates to unit test.

* Fixing readme

* Adding file needed for readme.

* Fixing snippet for readme.

* Fixing snippet for readme.

* Updating readme.

* Adding javadoc.

* Fixing unit test.

* Testing.

* Testing breaking out setup to be before unit test runs.

* Renaming file.

* Adding new test config for MultiTenantDB test.

* Adding cleanup to unit test.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
azure-spring All azure-spring related issues Cosmos
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[FEATURE REQ] Support multi-tenancy at database level in Cosmos Spring library
2 participants