Skip to content

RequestHandler

Creating Instance

RequestHandler takes the following to be created:

RequestHandler is created when:

KsqlEngine

RequestHandler is given a KsqlEngine when created.

The KsqlEngine is used for executing SQL Statements (to execute a Statement and isVariableSubstitutionEnabled).

DistributingExecutor

RequestHandler is given a DistributingExecutor when created.

The DistributingExecutor is used for executing KSQL statements.

Executing KSQL Statements

KsqlEntityList execute(
  KsqlSecurityContext securityContext,
  List<ParsedStatement> statements,
  SessionProperties sessionProperties)

For every SQL statement (in the given statements), execute requests the KsqlEngine to prepare it for execution (possibly with variable substitution) and then executes it.

execute is used when:

Executing KSQL Statement

<T extends Statement> Optional<KsqlEntity> executeStatement(
  KsqlSecurityContext securityContext,
  PreparedStatement<T> prepared,
  SessionProperties sessionProperties,
  KsqlEntityList entities)

executeStatement requests the given PreparedStatement for the Statement and its Java class that is used to request the CommandQueueSync to waitFor.

executeStatement creates a ConfiguredStatement for the given PreparedStatement (with a new SessionConfig).

executeStatement looks up the StatementExecutor for the Statement class in the CustomExecutors registry (or defaults to the DistributingExecutor to execute the statement).

executeStatement requests the StatementExecutor to execute the statement.

Unless handled, executeStatement requests the DistributingExecutor to execute the statement.

isVariableSubstitutionEnabled

boolean isVariableSubstitutionEnabled(
  SessionProperties sessionProperties)

isVariableSubstitutionEnabled is positive (true) when ksql.variable.substitution.enable is true in the given SessionProperties or the KsqlConfig (of the KsqlEngine).