Ksql¶
Ksql
is a standalone command-line application that can be executed using ksql shell script.
Ksql
uses KsqlRestClient to build a Cli to run the following:
- Command for
--execute
or-e
- Script for
--file
or-f
- Interactively otherwise
Launching Application¶
main
parses command-line options.
In the end, main
creates a Ksql (with the options, the system properties, a KsqlRestClient and a Cli) and runs it.
Creating Instance¶
Ksql
takes the following to be created:
-
Options
- System Properties
- KsqlClientBuilder
- Cli builder
Ksql
is created when:
Ksql
application is launched
KsqlClientBuilder¶
Ksql
is given a KsqlRestClient builder when created.
The builder is used to build a KsqlRestClient (that is then used in run to build a Cli).
Executing Statements¶
int run()
run
loads a config file (if defined).
run
uses the following options to build a Cli (using the cliBuilder and the KsqlRestClient):
streamedQueryRowLimit
streamedQueryTimeoutMs
outputFormat
(JSON
orTABULAR
)
run
requests the Cli
to add the session variables (based on definedVars
option).
run
branches off based on the options:
- With
execute
,run
requests theCli
to run the command - With
file
,run
requests theCli
to run the script file - Otherwise,
run
requests theCli
to run interactively
Building REST Client¶
KsqlRestClient buildClient(
Map<String, String> configProps
)
buildClient
uses the following options to build a KsqlRestClient (using the KsqlClientBuilder):
server
user
andpassword
for authentication (if needed)confluent-api-key
andconfluent-api-secret
(for Confluent Cloud ksqlDB server if needed)