org.springframework.data.gemfire.listener.ContinuousQueryListenerContainer Java Examples
The following examples show how to use
org.springframework.data.gemfire.listener.ContinuousQueryListenerContainer.
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: GeodeContinuousQueriesHealthIndicator.java From spring-boot-data-geode with Apache License 2.0 | 4 votes |
@Override protected void doHealthCheck(Health.Builder builder) { if (getContinuousQueryListenerContainer().isPresent()) { Optional<QueryService> queryService = getContinuousQueryListenerContainer() .map(ContinuousQueryListenerContainer::getQueryService); List<CqQuery> continuousQueries = queryService .map(QueryService::getCqs) .map(Arrays::asList) .orElseGet(Collections::emptyList); builder.withDetail("geode.continuous-query.count", continuousQueries.size()); queryService .map(QueryService::getCqStatistics) .ifPresent(cqServiceStatistics -> builder.withDetail("geode.continuous-query.number-of-active", cqServiceStatistics.numCqsActive()) .withDetail("geode.continuous-query.number-of-closed", cqServiceStatistics.numCqsClosed()) .withDetail("geode.continuous-query.number-of-created", cqServiceStatistics.numCqsCreated()) .withDetail("geode.continuous-query.number-of-stopped", cqServiceStatistics.numCqsStopped()) .withDetail("geode.continuous-query.number-on-client", cqServiceStatistics.numCqsOnClient()) ); continuousQueries.stream() .filter(Objects::nonNull) .forEach(continuousQuery -> { String continuousQueryName = continuousQuery.getName(); builder.withDetail(continuousQueryKey(continuousQueryName,"oql-query-string"), continuousQuery.getQueryString()) .withDetail(continuousQueryKey(continuousQueryName, "closed"), toYesNoString(continuousQuery.isClosed())) .withDetail(continuousQueryKey(continuousQueryName, "closing"), toYesNoString(continuousQuery.getState())) .withDetail(continuousQueryKey(continuousQueryName, "durable"), toYesNoString(continuousQuery.isDurable())) .withDetail(continuousQueryKey(continuousQueryName, "running"), toYesNoString(continuousQuery.isRunning())) .withDetail(continuousQueryKey(continuousQueryName, "stopped"), toYesNoString(continuousQuery.isStopped())); Query query = continuousQuery.getQuery(); if (query != null) { QueryStatistics queryStatistics = query.getStatistics(); if (queryStatistics != null) { builder.withDetail(continuousQueryQueryKey(continuousQueryName, "number-of-executions"), queryStatistics.getNumExecutions()) .withDetail(continuousQueryQueryKey(continuousQueryName, "total-execution-time"), queryStatistics.getTotalExecutionTime()); } } CqStatistics continuousQueryStatistics = continuousQuery.getStatistics(); if (continuousQueryStatistics != null) { builder.withDetail(continuousQueryStatisticsKey(continuousQueryName, "number-of-deletes"), continuousQueryStatistics.numDeletes()) .withDetail(continuousQueryStatisticsKey(continuousQueryName, "number-of-events"), continuousQueryStatistics.numEvents()) .withDetail(continuousQueryStatisticsKey(continuousQueryName, "number-of-inserts"), continuousQueryStatistics.numInserts()) .withDetail(continuousQueryStatisticsKey(continuousQueryName, "number-of-updates"), continuousQueryStatistics.numUpdates()); } }); builder.up(); return; } builder.unknown(); }
Example #2
Source File: ClientCacheHealthIndicatorConfiguration.java From spring-boot-data-geode with Apache License 2.0 | 4 votes |
@Bean("GeodeContinuousQueryHealthIndicator") GeodeContinuousQueriesHealthIndicator continuousQueriesHealthIndicator( @Autowired(required = false) ContinuousQueryListenerContainer continuousQueryListenerContainer) { return new GeodeContinuousQueriesHealthIndicator(continuousQueryListenerContainer); }
Example #3
Source File: GeodeContinuousQueriesHealthIndicatorUnitTests.java From spring-boot-data-geode with Apache License 2.0 | 3 votes |
@Before public void setup() { ContinuousQueryListenerContainer container = new ContinuousQueryListenerContainer(); container.setQueryService(this.mockQueryService); this.continuousQueriesHealthIndicator = new GeodeContinuousQueriesHealthIndicator(container); }
Example #4
Source File: GeodeContinuousQueriesHealthIndicator.java From spring-boot-data-geode with Apache License 2.0 | 2 votes |
/** * Returns an {@link Optional} reference to the configured {@link ContinuousQueryListenerContainer}. * * @return an {@link Optional} reference to the configured {@link ContinuousQueryListenerContainer}. * @see org.springframework.data.gemfire.listener.ContinuousQueryListenerContainer * @see java.util.Optional */ protected Optional<ContinuousQueryListenerContainer> getContinuousQueryListenerContainer() { return Optional.ofNullable(this.continuousQueryListenerContainer); }
Example #5
Source File: GeodeContinuousQueriesHealthIndicator.java From spring-boot-data-geode with Apache License 2.0 | 1 votes |
/** * Constructs an instance of the {@link GeodeContinuousQueriesHealthIndicator} initialized with a reference to * the {@link ContinuousQueryListenerContainer}. * * @param continuousQueryListenerContainer reference to the SDG {@link ContinuousQueryListenerContainer}. * @see org.springframework.data.gemfire.listener.ContinuousQueryListenerContainer */ public GeodeContinuousQueriesHealthIndicator(ContinuousQueryListenerContainer continuousQueryListenerContainer) { super("Continuous Queries health check enabled"); this.continuousQueryListenerContainer = continuousQueryListenerContainer; }