This project is a command-line client for Kafka Connect. Relying on the idioms and semantics of kubectl, it allows you to register and examine connectors, delete them, restart them, etc.
Display the help to learn about using kcctl:
kcctl help
Usage: kcctl [COMMAND]
A command-line interface for Kafka Connect
Commands:
info Displays information about the Kafka Connect cluster
config Sets or retrieves the configuration of this client
get Displays information about connector plug-ins, connectors and log level of connectors
delete Deletes the specified connector
restart Restarts the specified connector or task
describe Displays detailed information about the specified resource
apply Applies the given file for registering or updating a connector
patch Applies the patch to the connector depending on subcommand. (e.g. Changing log level at runtime)
help Displays help information about the specified command
It is recommended to install the bash/zsh completion script kcctl_completion:
. kcctl_completion
This project uses Quarkus, the Supersonic Subatomic Java Framework.
If you want to learn more about Quarkus, please visit its website: https://quarkus.io/ .
You can run your application in dev mode that enables live coding using:
./mvnw compile quarkus:dev
Default port is 5005, execute below script in debug mode and start the debugger. It will hit the breakpoint
mvn compile quarkus:dev -Dquarkus.args='patch get connectors' -Dsuspend
The application can be packaged using:
./mvnw package
It produces the quarkus-run.jar
file in the target/quarkus-app/
directory.
Be aware that it’s not an über-jar as the dependencies are copied into the target/quarkus-app/lib/
directory.
The application is now runnable using java -jar target/quarkus-app/quarkus-run.jar
.
You should define an alias kcctl:
alias kcctl="java -jar target/quarkus-app/quarkus-run.jar"
You can create a native executable using:
./mvnw package -Pnative
You can then execute your native executable with: ./target/code-with-quarkus-1.0.0-SNAPSHOT-runner
As above, either define an alias kcctl or rename the resulting executable accordingly.
Grep for usages of DummyCompletions
and uncomment them
(they are used as placeholders in the generated completion script).
Build the application in JVM mode.
Recreate the completion script:
java -cp "target/quarkus-app/app/*:target/quarkus-app/lib/main/*:target/quarkus-app/quarkus-run.jar" picoclutoutoComplete -n kcctl --force dev.morling.kccli.command.KcCtlCommand
Edit the completion scrpt kcctl_completion, replace all the dummy completion placeholders with invocations of one of the (hidden) completion candidate commands, e.g. like so:
--- local CONNECTOR_NAME_pos_param_args="connector-1 connector-2 connector-3" # 0-0 values
+++ local CONNECTOR_NAME_pos_param_args=`kcctl connector-name-completions` # 0-0 values
- Picocli (guide): Develop command line applications with Picocli
- Quarkus native apps (guide): Develop native applications with Quarkus and GraalVM
This code base is available ander the Apache License, version 2.