You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@geode.apache.org by "Jared Stewart (JIRA)" <ji...@apache.org> on 2016/09/20 21:33:20 UTC

[jira] [Created] (GEODE-1913) Calling the CQ API without the geode-cq module loaded should give a more descriptive exception

Jared Stewart created GEODE-1913:
------------------------------------

             Summary: Calling the CQ API without the geode-cq module loaded should give a more descriptive exception
                 Key: GEODE-1913
                 URL: https://issues.apache.org/jira/browse/GEODE-1913
             Project: Geode
          Issue Type: Improvement
          Components: querying
            Reporter: Jared Stewart


The interfaces for continuous query functionality (CqEvent, CqListener, etc) reside in the geode-core module but their implementations reside in the geode-cq module.  This results in a non-descriptive exception if CQs are invoked from an application which has loaded geode-core but not geode-cq.
For example,
{code}
ClientCache cache = new ClientCacheFactory()
                .addPoolLocator("localhost", 10334)
                .setPoolSubscriptionEnabled(true)
                .create();

  Region<String, BigDecimal> region = cache
                .<String, BigDecimal>createClientRegionFactory(ClientRegionShortcut.CACHING_PROXY)
                .create("regionA");

  CqAttributesFactory cqf = new CqAttributesFactory();
        cqf.addCqListener(new ExampleContinuousQueryListener());
        CqAttributes cqa = cqf.create();

  QueryService queryService = region.getRegionService().getQueryService();
        CqQuery priceTracker = queryService.newCq(cqName, queryStr, cqa);
{code}

gives the following exception:

{code}

Exception in thread "main" java.lang.IllegalStateException: CqService is not available.
    at com.gemstone.gemfire.cache.query.internal.cq.MissingCqService.start(MissingCqService.java:171)
    at com.gemstone.gemfire.cache.query.internal.DefaultQueryService.getCqService(DefaultQueryService.java:777)
    at com.gemstone.gemfire.cache.query.internal.DefaultQueryService.newCq(DefaultQueryService.java:562)
    at com.jaredjstewart.HelloWorld.main(HelloWorld.java:40)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at com.intellij.rt.execution.application.AppMain.main(AppMain.java:147)
{code}

It would be helpful to check whether the geode-cq module is available on the classpath before throwing this exception so that we could give the user a more explanatory message in the stack trace like "Continuous query functionality relies on the geode-cq module being loaded".



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)