Skip to content

KsqlResource

KsqlResource is used by KsqlRestApplication to execute statements (indirectly using KsqlServerEndpoints).

Creating Instance

KsqlResource takes the following to be created:

KsqlResource is created when:

CommandRunner

KsqlResource is given a CommandRunner when created.

The CommandRunner is used only to access the CommandQueue when:

configure

void configure(
  KsqlConfig config)

configure is part of the KsqlConfigurable abstraction.


configure...FIXME

shouldSynchronize

boolean shouldSynchronize(
  Class<? extends Statement> statementClass)

shouldSynchronize is true when the given statementClass is as follows:

  1. Not in SYNC_BLACKLIST
  2. In EXECUTOR_MAP

shouldSynchronize is used when:

SYNC_BLACKLIST

  • ListTopics
  • ListFunctions
  • DescribeFunction
  • ListProperties
  • SetProperty
  • UnsetProperty

RequestHandler

KsqlResource creates a RequestHandler when requested to configure.

RequestHandler is used when:

Handling KSQL Statements

EndpointResponse handleKsqlStatements(
  KsqlSecurityContext securityContext,
  KsqlRequest request)

handleKsqlStatements prints out the following INFO message to the logs:

Received: [request]

handleKsqlStatements requests the KsqlEngine to parse the KSQL text (from the given KsqlRequest).

handleKsqlStatements requests the RequestValidator to validate the statements (in a SandboxedServiceContext).

handleKsqlStatements requests the RequestHandler to execute the KSQL statements.

In the end, handleKsqlStatements prints out the following INFO message to the logs:

Processed successfully: [request]

handleKsqlStatements is used when:

  • KsqlServerEndpoints is requested to execute a KsqlRequest
  • ServerInternalKsqlClient is requested to makeKsqlRequest

Logging

Enable ALL logging level for io.confluent.ksql.rest.server.resources.KsqlResource logger to see what happens inside.

Add the following line to log4j.properties:

log4j.logger.io.confluent.ksql.rest.server.resources.KsqlResource=ALL

Refer to Logging.