Example usage for org.springframework.data.gemfire.listener ContinuousQueryDefinition getQuery

List of usage examples for org.springframework.data.gemfire.listener ContinuousQueryDefinition getQuery

Introduction

In this page you can find the example usage for org.springframework.data.gemfire.listener ContinuousQueryDefinition getQuery.

Prototype

public String getQuery() 

Source Link

Document

Gets the String query executed by the CQ.

Usage

From source file:org.springframework.data.gemfire.listener.ContinuousQueryListenerContainer.java

private CqQuery addCQuery(ContinuousQueryDefinition def) {
    try {//from   ww  w . j a v  a 2  s. co  m
        CqAttributesFactory caf = new CqAttributesFactory();
        caf.addCqListener(new EventDispatcherAdapter(def.getListener()));
        CqAttributes attr = caf.create();

        CqQuery cq = null;

        if (StringUtils.hasText(def.getName())) {
            cq = queryService.newCq(def.getName(), def.getQuery(), attr, def.isDurable());
        } else {
            cq = queryService.newCq(def.getQuery(), attr, def.isDurable());
        }

        queries.add(cq);
        return cq;
    } catch (RuntimeException ex) {
        throw new GemfireQueryException("Cannot create query ", ex);
    } catch (QueryException ex) {
        throw new GemfireQueryException("Cannot create query ", ex);
    }
}