KsqlRestApplication¶
KsqlRestApplication
is a ksqlDB API server (that can be started using ksql-server-start shell script).
Creating Instance¶
KsqlRestApplication
takes the following to be created:
- ServiceContext
- KsqlEngine
- KsqlConfig
- KsqlRestConfig
- CommandRunner
- CommandStore
-
StatusResource
-
StreamedQueryResource
- KsqlResource
- VersionCheckerAgent
-
KsqlSecurityContextProvider
-
KsqlSecurityExtension
-
AuthenticationPlugin
-
ServerState
-
ProcessingLogContext
-
KsqlServerPrecondition
s - KsqlConfigurables
- RocksDB Config Setter Handler (Function of KsqlConfig)
-
HeartbeatAgent
-
LagReportingAgent
- Vert.x
-
DenyListPropertyValidator
-
PullQueryExecutorMetrics
-
ScalablePushQueryMetrics
-
LocalCommands
- QueryExecutor
When created, KsqlRestApplication
prints out the following DEBUG message to the logs:
Creating instance of ksqlDB API server
In the end, KsqlRestApplication
prints out the following DEBUG message to the logs:
ksqlDB API server instance created
KsqlRestApplication
is created using buildApplication utility.
CommandRunner¶
KsqlRestApplication
is given a CommandRunner when created.
The CommandRunner
is requested to processPriorCommands followed by starting command execution in initialize. The CommandRunner
is up and running until shutdown (when it is requested to close).
The CommandRunner
is used to create a HealthCheckResource when KsqlRestApplication
is created.
KsqlConfigurables¶
KsqlRestApplication
is given KsqlConfigurables when created.
All the given KsqlConfigurables are also given separately to create the KsqlRestApplication
:
- KsqlResource
- StreamedQueryResource
InteractiveStatementExecutor
(that is part of the StatusResource)
KsqlConfigurable
s are requested to configure (with a KsqlConfig with an application.server property assigned) in startAsync.
Building KsqlRestApplication¶
KsqlRestApplication buildApplication(
KsqlRestConfig restConfig,
MetricCollectors metricCollectors)
buildApplication
is used when:
KsqlServerMain
is requested for an Executable
Step 1. Vert.x¶
buildApplication
creates a Vert.x subsystem.
Vert.x
Vert.x allows writing reactive applications on the JVM with support for HTTP, TCP, UDP, file system, asynchronous streams. etc.
buildApplication
creates an internal KsqlClient.
buildApplication
creates a KsqlSchemaRegistryClientFactory
and DefaultConnectClientFactory
.
buildApplication
determines the Kafka Cluster ID and reads the ksql.service.id configuration property (from the KsqlConfig).
buildApplication
creates a KsqlRestConfig.
buildApplication
...FIXME
buildApplication
creates a KsqlEngine.
buildApplication
...FIXME
buildApplication
builds the name of the command topic (to create a CommandStore and a CommandRunner).
buildApplication
creates a CommandStore.
Step x. InteractiveStatementExecutor¶
buildApplication
creates an InteractiveStatementExecutor.
buildApplication
...FIXME
buildApplication
creates a QueryExecutor and a StreamedQueryResource
.
Step x. CommandRunner¶
buildApplication
creates a CommandRunner (with the InteractiveStatementExecutor).
buildApplication
...FIXME
In the end, buildApplication
creates a KsqlRestApplication.
startAsync¶
void startAsync()
startAsync
prints out the following DEBUG message to the logs:
Starting the ksqlDB API server
startAsync
...FIXME
In the end, startAsync
prints out the following INFO message to the logs followed by displayWelcomeMessage.
ksqlDB API server listening on [comma-separated listeners]
startAsync
is part of the Executable abstraction.
displayWelcomeMessage¶
void displayWelcomeMessage()
displayWelcomeMessage
...FIXME
In the end, displayWelcomeMessage
prints out the following to the standard output:
Server [version] listening on [comma-separated listeners]
To access the KSQL CLI, run:
ksql [listener]
startKsql¶
void startKsql(
KsqlConfig ksqlConfigWithPort)
startKsql
...FIXME
initialize¶
void initialize(
KsqlConfig configWithApplicationServer)
initialize
...FIXME
registerCommandTopic¶
void registerCommandTopic()
registerCommandTopic
...FIXME