我正在尝试在Apache Geode上创建连续查询。但要低于例外
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]
我使用
创建了我的区域create region --name=Student --type=REPLICATE --enable-statistic=true --enable-subscription-conflation=true
请在下面找到我用于创建QueryService和注册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;
}
如果有人可以分享Gemfire Continuous Query
的工作示例,那将是一个很大的帮助答案 0 :(得分:0)
我从Geode用户列表中得到了上述问题的答案。我使用了错误的Geode版本,M2 Release
后支持Continuous Query功能