Skip to content

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:

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:

Ksql is created when:

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 builds a KsqlRestClient.

run uses the following options to build a Cli (using the cliBuilder and the KsqlRestClient):

  • streamedQueryRowLimit
  • streamedQueryTimeoutMs
  • outputFormat (JSON or TABULAR)

run requests the Cli to add the session variables (based on definedVars option).

run branches off based on the options:

Building REST Client

KsqlRestClient buildClient(
  Map<String, String> configProps
)

buildClient uses the following options to build a KsqlRestClient (using the KsqlClientBuilder):

  • server
  • user and password for authentication (if needed)
  • confluent-api-key and confluent-api-secret (for Confluent Cloud ksqlDB server if needed)