org.springframework.data.gemfire.listener.annotation.ContinuousQuery Java Examples

The following examples show how to use org.springframework.data.gemfire.listener.annotation.ContinuousQuery. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: TemperatureMonitor.java    From spring-boot-data-geode with Apache License 2.0 5 votes vote down vote up
@ContinuousQuery(name = "BoilingTemperatureMonitor",
	query = "SELECT * FROM /TemperatureReadings WHERE temperature >= 212")
public void boilingTemperatureReadings(CqEvent event) {

	Optional.ofNullable(event)
		.map(CqEvent::getNewValue)
		.filter(TemperatureReading.class::isInstance)
		.map(TemperatureReading.class::cast)
		.map(it -> new BoilingTemperatureEvent(this, it))
		.ifPresent(this.applicationEventPublisher::publishEvent);
}
 
Example #2
Source File: TemperatureMonitor.java    From spring-boot-data-geode with Apache License 2.0 5 votes vote down vote up
@ContinuousQuery(name = "FreezingTemperatureMonitor",
	query = "SELECT * FROM /TemperatureReadings WHERE temperature <= 32")
public void freezingTemperatureReadings(CqEvent event) {

	Optional.ofNullable(event)
		.map(CqEvent::getNewValue)
		.filter(TemperatureReading.class::isInstance)
		.map(TemperatureReading.class::cast)
		.map(it -> new FreezingTemperatureEvent(this, it))
		.ifPresent(this.applicationEventPublisher::publishEvent);
}
 
Example #3
Source File: TemperatureReadingsContinuousQueriesHandler.java    From spring-boot-data-geode with Apache License 2.0 5 votes vote down vote up
@ContinuousQuery(name = "BoilingTemperatures",
	query = "SELECT * FROM /TemperatureReadings r WHERE r.temperature >= 212")
public void boilingTemperatures(CqEvent event) {

	TemperatureReading temperatureReading = (TemperatureReading) event.getNewValue();

	this.boilingTemperatureReadings.add(temperatureReading);
	this.temperatureReadingsCounter.incrementAndGet();
}
 
Example #4
Source File: TemperatureReadingsContinuousQueriesHandler.java    From spring-boot-data-geode with Apache License 2.0 5 votes vote down vote up
@ContinuousQuery(name = "FreezingTemperatures",
	query = "SELECT * FROM /TemperatureReadings r WHERE r.temperature <= 32")
public void freezingTemperatures(CqEvent event) {

	TemperatureReading temperatureReading = (TemperatureReading) event.getNewValue();

	this.freezingTemperatureReadings.add(temperatureReading);
	this.temperatureReadingsCounter.incrementAndGet();
}
 
Example #5
Source File: QueryTests.java    From spring-data-examples with Apache License 2.0 4 votes vote down vote up
@ContinuousQuery(name = "CustomerCQ", query = "SELECT * FROM /Customers")
public void handleEvent(CqEvent event) {
	log.info("Received message for CQ 'CustomerCQ'" + event);
	counter.incrementAndGet();
}
 
Example #6
Source File: AuthorService.java    From tutorials with MIT License 4 votes vote down vote up
@ContinuousQuery(query = "SELECT * FROM /Authors a WHERE a.id = 1")
public void process(CqEvent event) {
    System.out.println("Author #" + event.getKey() + " updated to " + event.getNewValue());
}