In addition to the other great suggestions, if you want to stick with the pattern in the original example, I attached a DestroyFunctionCommand and updated CreateRegionCacheListener that'll destroy the region. The functions could use a bit of refactoring.
Thanks, Barry Oglesby On Fri, Apr 8, 2016 at 8:43 AM, Olivier Mallassi <[email protected] > wrote: > Hi Mike, > > Thank you for the clarification, that was my guess. > Regarding the destruction of the region, I was thinking about removing the > key in metadataRegion and delete the region in the callback (to be tested). > > Cheers. > > On Fri, Apr 8, 2016 at 4:55 PM, Michael Stolz <[email protected]> wrote: > >> The reason you need the RegionAttributesMetadataRegion is so that if a >> server goes away and comes back, or a new server joins, it knows to >> recreate the regions that were dynamically created as defined in the >> RegionAttributesMetadataRegion. >> >> If you are going to destroy regions you will also need to remove their >> definitions from the RegionAttributesMetadataRegion. >> >> I believe <dynamic-region-factory> won't work for Partitioned Regions. >> >> >> >> -- >> Mike Stolz >> Principal Engineer, GemFire Product Manager >> Mobile: 631-835-4771 >> >> On Fri, Apr 8, 2016 at 6:28 AM, Olivier Mallassi < >> [email protected]> wrote: >> >>> Hello everybody, >>> >>> my apologies if the question has already been asked on the ML (I cannot >>> find the answer in the archive). >>> >>> I have a need to programmatically create / delete region. I am not >>> talking about creating / deleting regions every second or minutes. the need >>> is a pure administration need (being able to create regions via an REST >>> API). >>> >>> I have found the sample code in the documentation ( >>> http://geode.docs.pivotal.io/docs/developing/region_options/dynamic_region_creation.html) >>> and was wondering if you can help with the following questions >>> - why are we using this "metadataregion"? is it to support elasticity >>> (add / remove nodes)? other reasons? >>> - Can we delete the regions using the same principle (with another >>> callback)? >>> - is it better to use the <dynamic-region-factory> knowing I need >>> partition_redundant regions? it looks not to be a valid option. >>> >>> Many thanks for your help. >>> >>> oliv/ >>> >> >> >
CreateRegionCacheListener.java
Description: Binary data
DestroyRegionFunction.java
Description: Binary data
