use of io.confluent.ksql.engine.KsqlEngine in project ksql by confluentinc.
the class RequestHandler method executeStatement.
@SuppressWarnings("unchecked")
private <T extends Statement> Optional<KsqlEntity> executeStatement(final KsqlSecurityContext securityContext, final PreparedStatement<T> prepared, final SessionProperties sessionProperties, final KsqlEntityList entities) {
final Class<? extends Statement> statementClass = prepared.getStatement().getClass();
commandQueueSync.waitFor(new KsqlEntityList(entities), statementClass);
final ConfiguredStatement<T> configured = ConfiguredStatement.of(prepared, SessionConfig.of(this.ksqlEngine.getKsqlConfig(), sessionProperties.getMutableScopedProperties()));
FeatureFlagChecker.throwOnDisabledFeatures(configured);
final StatementExecutor<T> executor = (StatementExecutor<T>) customExecutors.getOrDefault(statementClass, (stmt, props, ctx, svcCtx) -> distributor.execute(stmt, ctx, securityContext));
final StatementExecutorResponse response = executor.execute(configured, sessionProperties, ksqlEngine, securityContext.getServiceContext());
if (response.isHandled()) {
return response.getEntity();
} else {
return distributor.execute(configured, ksqlEngine, securityContext).getEntity();
}
}
use of io.confluent.ksql.engine.KsqlEngine in project ksql by confluentinc.
the class SecureIntegrationTest method givenTestSetupWithConfig.
private void givenTestSetupWithConfig(final Map<String, Object> ksqlConfigs) {
ksqlConfig = new KsqlConfig(ksqlConfigs);
serviceContext = ServiceContextFactory.create(ksqlConfig, DisabledKsqlClient::instance);
ksqlEngine = new KsqlEngine(serviceContext, ProcessingLogContext.create(), new InternalFunctionRegistry(), ServiceInfo.create(ksqlConfig), new SequentialQueryIdGenerator(), ksqlConfig, Collections.emptyList(), new MetricCollectors());
execInitCreateStreamQueries();
}
use of io.confluent.ksql.engine.KsqlEngine in project ksql by confluentinc.
the class ClientIntegrationTest method verifyNumActiveQueries.
private static void verifyNumActiveQueries(final int numQueries) {
final KsqlEngine engine = (KsqlEngine) REST_APP.getEngine();
assertThatEventually(engine::numberOfLiveQueries, is(numQueries));
}
Aggregations