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

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

Introduction

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

Prototype

public String getName() 

Source Link

Document

Gets the String name of the CQ.

Usage

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

private CqQuery addCQuery(ContinuousQueryDefinition def) {
    try {/*ww w. j a  v a2s  .c  o  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);
    }
}