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
--executeor-e - Script for
--fileor-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:
Ksqlapplication 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):
streamedQueryRowLimitstreamedQueryTimeoutMsoutputFormat(JSONorTABULAR)
run requests the Cli to add the session variables (based on definedVars option).
run branches off based on the options:
- With
execute,runrequests theClito run the command - With
file,runrequests theClito run the script file - Otherwise,
runrequests theClito run interactively
Building REST Client¶
KsqlRestClient buildClient(
Map<String, String> configProps
)
buildClient uses the following options to build a KsqlRestClient (using the KsqlClientBuilder):
serveruserandpasswordfor authentication (if needed)confluent-api-keyandconfluent-api-secret(for Confluent Cloud ksqlDB server if needed)