microsoft / spring-data-cosmosdb

Access data with Azure Cosmos DB
MIT License
93 stars 68 forks source link

Multiple DataSource(With CosmosDB) In Spring boot JPA #554

Closed rannoune closed 3 years ago

rannoune commented 3 years ago

Hello,

I am in urgent need to connect to both Mysql and CosmosDB in my springboot application as we are incrementally migrating from mysql to cosmosdb. I checked the following link: https://github.com/microsoft/spring-data-cosmosdb/issues/403 But, I am using azure-cosmosdb-spring-boot-starter 2.3.5 and it does not work for me. I know @kushagraThapar mentioned that this will be supported in the next major version. Can you please let me know when the version will be released? And what workaround I can in the meanwhile implemented to make it work with the starter version 2.3.5?

Thank you

kushagraThapar commented 3 years ago

@rannoune - this is currently supported in azure-spring-data-cosmos v3.x.x @saragluna @chenrujun - can you please provide the timeline for when this will be available in spring boot starter ?

chenrujun commented 3 years ago

Hi, @rannoune,

Please use our latest version: https://repo.maven.apache.org/maven2/com/azure/spring/azure-spring-boot-starter-cosmos/3.0.0-beta.1/

Repo: https://github.com/Azure/azure-sdk-for-java/tree/azure-spring-boot-starter-cosmos_3.0.0-beta.1/sdk/spring/azure-spring-boot-starter-cosmos

rannoune commented 3 years ago

Thank you @kushagraThapar and @chenrujun for your quick response! We definitely want to use the springboot starter but since there is no stable version yet, we will use the azure-spring-data-cosmos v3.0.1 for now and then we can switch to the springboot starter once we have a non-beta version is available. @chenrujun do you have an estimate on when the first non-beta release is going to be out?

kushagraThapar commented 3 years ago

@rannoune - use - https://mvnrepository.com/artifact/com.azure/azure-spring-data-cosmos/3.1.0 3.1.0 version

rannoune commented 3 years ago

will do. Thank you!

chenrujun commented 3 years ago

@rannoune , we will release azure-spring-boot-starter-cosmos GA around mid of Dec.

woodymoo commented 3 years ago

@chenrujun I tried the multidatabase samples on the folder which is new spring data cosmos release version 3.4.0, but it does not work. can you please provide a complete sample with pom.xml ? BTW, can I modify the connection uri information in RepositoryConfiguration and CosmosClient at runtime? to switch to another database at runtime?

https://github.com/Azure/azure-sdk-for-java/tree/master/sdk/cosmos/azure-spring-data-cosmos/src/samples/java/com/azure/spring/data/cosmos/multidatasource https://github.com/Azure/azure-sdk-for-java/tree/master/sdk/cosmos/azure-spring-data-cosmos

woodymoo commented 3 years ago

Is there

@chenrujun I tried the multidatabase samples on the folder which is new spring data cosmos release version 3.4.0, but it does not work. can you please provide a complete sample with pom.xml ? BTW, can I modify the connection uri information in RepositoryConfiguration and CosmosClient at runtime? to switch to another database at runtime?

https://github.com/Azure/azure-sdk-for-java/tree/master/sdk/cosmos/azure-spring-data-cosmos/src/samples/java/com/azure/spring/data/cosmos/multidatasource https://github.com/Azure/azure-sdk-for-java/tree/master/sdk/cosmos/azure-spring-data-cosmos

Is there any update? please, are you going to publish a complete multidatabase sample?

chenrujun commented 3 years ago

Hi, @yiliuTo , could you please help to investigate this issue? I remember that the feature(multidatabase) is developed by Fenqin.

yiliuTo commented 3 years ago

Hi @woodymoo , @lzc-1997-abel is working on the multi-database configuration sample and your questions. And he will update here when the sample is completed.

zhichengliu12581 commented 3 years ago

Hi @woodymoo, Here is the multi-database configuration sample with multi account, and here is the multi-database with single account.If you wanner switch to another database at runtime, use ReactiveCosmosTemplate or CosmosTemplate with different CosmosConfig and CosmosAsyncClient might work.

saragluna commented 3 years ago

Closing this issue now since there's no update from the customer. Please reopen it if you have any further questions.