Search in sources :

Example 1 with QueryCleanupTask

use of io.confluent.ksql.engine.QueryCleanupService.QueryCleanupTask in project ksql by confluentinc.

the class KsqlEngineTest method awaitCleanupComplete.

private void awaitCleanupComplete(final KsqlEngine ksqlEngine) {
    // add a task to the end of the queue to make sure that
    // we've finished processing everything up until this point
    Optional<String> nameTopology;
    if (ksqlEngine.getKsqlConfig().getBoolean(KsqlConfig.KSQL_SHARED_RUNTIME_ENABLED)) {
        nameTopology = Optional.of("test");
    } else {
        nameTopology = Optional.empty();
    }
    ksqlEngine.getCleanupService().addCleanupTask(new QueryCleanupTask(serviceContext, "", nameTopology, false, "", KsqlConfig.KSQL_SERVICE_ID_DEFAULT, KsqlConfig.KSQL_PERSISTENT_QUERY_NAME_PREFIX_DEFAULT) {

        @Override
        public void run() {
        // do nothing
        }
    });
    // with a condition variable wait/notify pattern
    while (!ksqlEngine.getCleanupService().isEmpty()) {
        Thread.yield();
    }
}
Also used : Matchers.containsString(org.hamcrest.Matchers.containsString) QueryCleanupTask(io.confluent.ksql.engine.QueryCleanupService.QueryCleanupTask)

Aggregations

QueryCleanupTask (io.confluent.ksql.engine.QueryCleanupService.QueryCleanupTask)1 Matchers.containsString (org.hamcrest.Matchers.containsString)1