in queries/src/main/java/org/apache/geode_examples/queries/Example.java [38:64]
public static void main(String[] args) throws NameResolutionException, TypeMismatchException,
QueryInvocationTargetException, FunctionDomainException {
// connect to the locator using default port 10334
ClientCache cache = new ClientCacheFactory().addPoolLocator("127.0.0.1", 10334)
.set("log-level", "WARN").create();
// create a region on the server
Region<Integer, EmployeeData> region =
cache.<Integer, EmployeeData>createClientRegionFactory(ClientRegionShortcut.PROXY)
.create(REGIONNAME);
// create a set of employee data and put it into the region
Map<Integer, EmployeeData> employees = createEmployeeData();
region.putAll(employees);
// count the values in the region
int inserted = region.keySetOnServer().size();
System.out.println(String.format("Counted %d keys in region %s", inserted, region.getName()));
// fetch and print all values in the region (without using a query)
region.keySetOnServer().forEach(key -> System.out.println(region.get(key)));
// do a set of queries, printing the results of each query
doQueries(cache);
cache.close();
}