Hey guys, I'm currently trying to hack my way through implementing multi tenancy with arangodb spring data.
the plan is to have multiple ArangoRepositories that each reference different arangodb db instance.
after some reading online and deep diving into the code i came up with this example
Map<String, ArangoRepository<ArangoDocument>> repos = (Map<String, ArangoRepository<ArangoDocument>>) applicationContext.getBeansOfType(typeRef.getClass());
final ArangoOperations operations = arangoConfig.arangoTemplate();
ArangoRepositoryFactory arangoRepoFactory = new ArangoRepositoryFactory(operations);
arangoRepoFactory.setQueryLookupStrategyKey(Key.CREATE_IF_NOT_FOUND);
repos.entrySet().stream().forEach(entry -> {
ArangoRepositoryFactoryBean<? extends ArangoRepository, String> repoBean = new ArangoRepositoryFactoryBean<>(entry.getValue().getClass());
repoBean.setArangoOperations(operations);
});
ArangoDiscoveryRepository discovery = arangoRepoFactory.getRepository(ArangoDiscoveryRepository.class);
quick review over the code:
im creating manually a ArangoOperation object for each db
instantiate a ArangoRepositoryFactory with the correct ArangoOperation
set the default lookup strategy
register the correct repositories
and then use the factory to obtain an instance of the repository
My questions are :
I didnt find any by design support in arangodb spring data for multi tenancy, did i miss it?
is there any things i need to take into account with the way im doing it?
Note: its just play around code
Any advice will be extremely appreciated