I see you are using M1 release, but CQ is available in Geode since M2 release.
On Jul 25, 2016 5:22 AM, "Amit Hora" <[email protected]> wrote: > I am trying to do a POC on Continuous query feature of Apache Gemfire but > getting below exception > > Caused by: java.lang.IllegalStateException: CqService is not available. > at > com.gemstone.gemfire.cache.query.internal.cq.MissingCqService.start(MissingCqService.java:171) > ~[gemfire-core-1.0.0-incubating.M1.jar:na] > at > com.gemstone.gemfire.cache.query.internal.DefaultQueryService.getCqService(DefaultQueryService.java:810) > ~[gemfire-core-1.0.0-incubating.M1.jar:na] > at > com.gemstone.gemfire.cache.query.internal.DefaultQueryService.newCq(DefaultQueryService.java:595) > ~[gemfire-core-1.0.0-incubating.M1.jar:na] > at > com.gemfirepo.GedoeConfiguration.getQueryService(GedoeConfiguration.java:79) > ~[classes/:na] > at > com.gemfirepo.GedoeConfiguration$$EnhancerBySpringCGLIB$$9bd68b16.CGLIB$getQueryService$1(<generated>) > ~[classes/:na] > at > com.gemfirepo.GedoeConfiguration$$EnhancerBySpringCGLIB$$9bd68b16$$FastClassBySpringCGLIB$$5b2bc172.invoke(<generated>) > ~[classes/:na] > at > org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:228) > ~[spring-core-4.2.7.RELEASE.jar:4.2.7.RELEASE] > at > org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:356) > ~[spring-context-4.2.7.RELEASE.jar:4.2.7.RELEASE] > at > com.gemfirepo.GedoeConfiguration$$EnhancerBySpringCGLIB$$9bd68b16.getQueryService(<generated>) > ~[classes/:na] > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) > ~[na:1.8.0_45] > at > sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) > ~[na:1.8.0_45] > at > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) > ~[na:1.8.0_45] > at java.lang.reflect.Method.invoke(Method.java:497) ~[na:1.8.0_45] > > I have created my region using > > create region --name=Student --type=REPLICATE --enable-statistic=true > --enable-subscription-conflation=true > > Kindly find below code i am using for creating QueryService and > registering for CQ > > @Bean > QueryService getQueryService() throws CqException, QueryInvalidException, > CqExistsException, CqClosedException, RegionNotFoundException{ > ClientCache cache =appContext.getBean(ClientCache.class); > > QueryService qservice= cache.getQueryService(); > > CqAttributesFactory cqf = new CqAttributesFactory(); > cqf.addCqListener(new CqListener() { > > @Override > public void close() { > // TODO Auto-generated method stub > > } > > @Override > public void onEvent(CqEvent aCqEvent) { > // TODO Auto-generated method stub > System.out.println("Event Recieved !"); > } > > @Override > public void onError(CqEvent aCqEvent) { > // TODO Auto-generated method stub > > } > }); > CqQuery studentTracker=qservice.newCq("StudentQuery","SELECT name > from /Student where rollNo==0",cqf.create()); > > // qservice.executeCqs("/Student"); > studentTracker.execute(); > // System.out.println(qservice.getCqStatistics().numCqsActive()+" > *****************"); > studentTracker.close(); > return qservice; > } > > Even i tried starting CqService manually but no Luck! same error > PoolFactory pf = PoolManager.createFactory(); > > pf.addLocator(PropertiesCache.getInstance().getProperty("hostname"), 10334); > // pf.addServer("localhost", 40404); > pf.setSubscriptionEnabled(true); > Pool pool = pf.create("client"); > > QueryService qservice= pool.getQueryService(); > CqService cqService = > ((DefaultQueryService)qservice).getCqService(); // cqService not available. > > cqService.start(); > > It will be a great help if someone can share working example for Gemfire > Continuous Query > > >
