Skip to content

ValidatedCommandFactory

ValidatedCommandFactory is a collection of utilities to create validated commands (that are safe to enqueue onto the command queue).

Creating Validated Command

Command create(
  ConfiguredStatement<? extends Statement> statement,
  KsqlExecutionContext context)
Command create(
  ConfiguredStatement<? extends Statement> statement,
  ServiceContext serviceContext,
  KsqlExecutionContext context

create creates a Command.

create...FIXME


create is used when:

Creating Command

Command create(
  ConfiguredStatement<? extends Statement> statement,
  KsqlExecutionContext context)
Command create(
  ConfiguredStatement<? extends Statement> statement,
  ServiceContext serviceContext,
  KsqlExecutionContext context

createCommand...FIXME

createForAlterSystemQuery

Command createForAlterSystemQuery(
  ConfiguredStatement<? extends Statement> statement,
  KsqlExecutionContext context)

createForAlterSystemQuery...FIXME

createForPlannedQuery

Command createForPlannedQuery(
  ConfiguredStatement<? extends Statement> statement,
  ServiceContext serviceContext,
  KsqlExecutionContext context)

createForPlannedQuery requests the given KsqlExecutionContext to plan a DDL/DML statement (that gives a KsqlPlan).

createForPlannedQuery creates a ConfiguredKsqlPlan.

createForPlannedQuery...FIXME

createForTerminateQuery

Command createForTerminateQuery(
  ConfiguredStatement<? extends Statement> statement,
  KsqlExecutionContext context)

createForTerminateQuery assumes that the given statement is a TerminateQuery.

createForTerminateQuery handles the following cases:

  1. No queryId defined to close all the running persistent queries
  2. queryIds with the transient_ query name prefix
  3. Non-CREATE_SOURCE persistent queries

With no queryId defined, createForTerminateQuery requests all the running persistent queries (in the given KsqlExecutionContext) to close and returns a Command with the given statement.

For a queryId that contains the transient_ query name prefix, createForTerminateQuery returns a Command with the given statement.

For all the other queryIds, createForTerminateQuery looks up the query (in the given KsqlExecutionContext) to close it.

In the end, createForTerminateQuery returns a Command with the given statement.


createForTerminateQuery throws a KsqlStatementException for CREATE_SOURCE queries:

Cannot terminate query '[queryId]' because it is linked to a source table.