I am trying to creating the gemfire regions with API methods available in the gemfire-8.2.11.jar. For this I have created one spring boot application , here I am creating the dynamic gemfire regions with code , when my application starts it will connect to gemfire locator and creating the server.
After that the gemfire region is creating, checked in gemfire server with command prompt. Here the problem is if I shutdown my application , the regions are also going way ,that means regions names are not persisting ( not updating the region details in cluster.xml).That means temporally regions are creating in the memory. Please any one can help how to make the regions persistent with grammatically.DO I need to set any properties to CashFactory?. As per given below link , followed the coding as per gemfire documentation.
Getting Cache factory object
Cache cache = new CacheFactory().set("name", "TestServer")
.set("locators","localhost[10334]")
.set("log-level", "config")
.create();
RegionFactory<Object, Object> rf = cache.createRegionFactory(RegionShortcut.REPLICATE);
rf.setCacheLoader(new TestCacheLoader());
rf.setCacheWriter(new TestCacheWriter());
Region<Object, Object> createdRegion = rf.create("Test");
Need to persist grammatically created regions with my application.
In order for the region configuration to be persisted across restarts you need to use the Cluster Configuration Service, please have a look at Configuring and Running a Cluster for further details about this. Unfortunately in GemFire 8.2.X there was no public API to manually use this configuration service (the only way to modify cluster configuration is through internal methods or manually editing the configuration xml file while the cluster is offline) so your only option would be to use GemFire SHell. Newer versions of GemFire also have this limitation, but there's an enhancement currently being worked to make this configurable through he API directly (please have a look at Cluster Management Service for further details).
As a side note, and considering that you're using Spring Boot already, Spring Boot for Apache Geode & Pivotal GemFire has made huge improvements around usability and configurability, it can certainly give you more flexibility and help you achieve your goal here (specifically the @EnableClusterConfiguration
annotation).
Hope this helps. Cheers.
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments