无法在Geode上创建连续查询 [英] Unable to create Continuous Query on geode

查看:199
本文介绍了无法在Geode上创建连续查询的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在Apache Geode上创建连续查询.但是要获得例外

I am trying to do a poc on creating continiuous query on Apache Geode. 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]

我已经使用

create region --name=Student --type=REPLICATE --enable-statistic=true --enable-subscription-conflation=true

请找到以下我用于创建QueryService和注册CQ的代码

Please 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;
    }

如果有人可以分享Gemfire连续查询的工作示例,这将是一个很大的帮助

It will be a great help if someone can share working example for Gemfire Continuous Query

推荐答案

我从Geode用户列表中得到了上述问题的答案.我使用的是错误版本的Geode,M2发布后便支持连续查询功能

I got answer for above problem from Geode user list . I was using wrong version of Geode the Continuous Query feature is supported after M2 Release

这篇关于无法在Geode上创建连续查询的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆