in cq/src/main/java/org/apache/geode_examples/cq/Example.java [79:99]
private CqQuery startCQ(ClientCache cache, Region region)
throws CqException, RegionNotFoundException, CqExistsException {
// Get cache and queryService - refs to local cache and QueryService
CqAttributesFactory cqf = new CqAttributesFactory();
cqf.addCqListener(new RandomEventListener());
CqAttributes cqa = cqf.create();
String cqName = "randomTracker";
String queryStr = "SELECT * FROM /example-region i where i > 70";
QueryService queryService = region.getRegionService().getQueryService();
CqQuery randomTracker = queryService.newCq(cqName, queryStr, cqa);
randomTracker.execute();
System.out.println("------- CQ is running\n");
return randomTracker;
}