We are running Gemfire 8.1, a Pivotal version of Geode chosen by our client in order to provide support, the current application is using Spring Data Gemfire, so the configuration is mixed between client-config.xml
and Spring Beans and it works properly.
I intend to do a tool application to help some data manipulation, initially I wished to do it on Go, but the Geode plugin is not ready yet and I would rather to avoid disordering the environment to provide the REST API.
I started it in Java as simple as possible, only with the Geode Core dependency as we can see in the official sample, and I am transposing xml configuration on code, but no matter which combination I do I am never able to get the remote keys, all regions always return empty maps, even registring ALL_KEYS
interest.
I have tried to connect directly to the server instead of to the locator, with and without subscription, running the code on my machine or even directly on the server machine, always the same result.
Debugging the currenct application code (the working one not this tool), I am inclined to say the problem is with the region, as I have tried to assign a not yet registred region with CacheFactory.getAnyInstance().createClientRegionFactory(ClientRegionShortcut.PROXY).create("region-name")
and I obtained region.getAttributes().getDataPolicy()
as EMPTY
rather than NORMAL
the other regions are, and my tool have the same behaviour, with all new regions with DataPolicy
being EMPY
.
If I connect via gfsh
I am able to list members and regions, I wonder what would gfsh
and Spring Data doing different to be able to handle server-side data.
How can I do a application that to the same the gfsh
does as simple as possible? I just want to connect and read some regions.
When using ClientRegionShortcut.PROXY
, the region has no local state and forwards all operations to the server, as described in the javadocs, that's why the keys are not stored locally on client side, the client is just a data accessor to the region. You need to use ClientRegionShortcut. CACHING_PROXY
instead, which is similar to PROXY
but also has local state.
More information about this topic can also be found in Region Shortcuts and Custom Named Region Attributes.
Hope this helps.
Cheers.