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

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

Introduction

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

Prototype

public ContinuousQueryListener getListener() 

Source Link

Document

Returns a reference to the ContinuousQueryListener that will process/handle CQ event notifications.

Usage

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

private CqQuery addCQuery(ContinuousQueryDefinition def) {
    try {/*from w w w  . j av a2  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);
    }
}