KsqlResource¶
KsqlResource
is used by KsqlRestApplication to execute statements (indirectly using KsqlServerEndpoints).
Creating Instance¶
KsqlResource
takes the following to be created:
- KsqlEngine
- CommandRunner
- ksql.server.command.response.timeout.ms
-
ActivenessRegistrar
- Injector factory
-
Errors
Handlers -
DenyListPropertyValidator
- CommandRunner warning message
KsqlResource
is created when:
KsqlRestApplication
utility is used to build a KsqlRestApplication (and creates a KsqlRestApplication)
CommandRunner¶
KsqlResource
is given a CommandRunner when created.
The CommandRunner
is used only to access the CommandQueue when:
- configure (to create a DistributingExecutor and a DefaultCommandQueueSync for RequestHandler)
- handleKsqlStatements (to httpWaitForCommandSequenceNumber)
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:
- Not in SYNC_BLACKLIST
- In EXECUTOR_MAP
shouldSynchronize
is used when:
KsqlResource
is requested to configure (and creates aDefaultCommandQueueSync
for the RequestHandler)
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 KsqlRequestServerInternalKsqlClient
is requested tomakeKsqlRequest
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.