I'm using MapStore to persist the data into Database.
My application is a multi-tenant application so if new tenant comes in how to create a map at run time in mapstore..
if you see in the below code, currently I have hardcoded for tenant-1.
this is my configuration class
@Component
public class CacheConfig {
@Bean
public static Config config() {
System.err.println("config class");
Config config = new Config();
config.setInstanceName("hazelcast");
MapConfig mapCfg = new MapConfig();
mapCfg.setName("tenant-1");
mapCfg.setBackupCount(2);
mapCfg.setTimeToLiveSeconds(300);
MapStoreConfig mapStoreCfg = new MapStoreConfig();
mapStoreCfg.setClassName(PersonMapStore.class.getName()).setEnabled(true);
mapCfg.setMapStoreConfig(mapStoreCfg);
config.addMapConfig(mapCfg);
return config;
}
}
Any suggestions would be very helpful..
Thanks in advance....
you can use wildcards in the name. For example, you can set the name of the configuration to tenant-*
to cover all tenants with the names like tenant-1
, tenant-2
...