Pivotal GemFire® v8.0

Configuring Continuous Querying

Configuring Continuous Querying

Continuous querying enables you to create a query and then to receive notifications when new data is added that matches the query. Continuous querying requires a client/server topology and the client connection must set the subscription-enabled property.

The following client Spring application context XML configuration (from the quickstart/cq example) declares a datasource with the subscription-enabled property. The file also declares a continuous query listener container, which enables continuous querying for a POJO (the cqListener bean).
	<gfe-data:datasource subscription-enabled="true">
		<gfe-data:server host="localhost" port="40404" />

		<gfe:listener ref="cqListener"
			query="select * from /Order where customerId = 2" />

	<bean id="cqListener" class="" />
The CQListener class (from the quickstart/cq example) implements a simple event handler to log each continuous query event:
public class CQListener {
	private static Log log = LogFactory.getLog(CQListener.class);

	public void handleEvent(CqEvent event) {"Received a CQ event " + event);

Additional Resources