Table of Contents

KNet: CLI

Installation

KNet CLI is available in two different formats:

Important

The dotnet tool needs a JRE/JDK installed within the system

Usage

Execute an Apache Kafka command

To use the CLI interface (KNetCLI) runs a command like the following:

  • dotnet tool
knet -ClassToRun ConsoleConsumer --bootstrap-server SERVER-ADDRESS:9093 --topic topic_name --from-beginning
  • Docker image
docker run ghcr.io/masesgroup/knet -ClassToRun ConsoleConsumer --bootstrap-server SERVER-ADDRESS:9093 --topic topic_name --from-beginning
docker run masesgroup/knet -ClassToRun ConsoleConsumer --bootstrap-server SERVER-ADDRESS:9093 --topic topic_name --from-beginning

Execute an interactive shell

To use the CLI interface (KNetCLI) in interactive mode runs a command like the following:

  • dotnet tool
knet -i

knet -i

  • Docker image
docker run ghcr.io/masesgroup/knet -i
docker run masesgroup/knet -i

Execute in script based mode

To use the CLI interface (KNetCLI) in script based mode runs a command like the following:

  • dotnet tool
knet -s path-to-script
  • Docker image
docker run ghcr.io/masesgroup/knet -s path-to-script
docker run masesgroup/knet -s path-to-script

Command line switches available

knetcli needs at least ClassToRun, Interactive or Script command-line switch to identify its behavior. Here the list:

  • ClassToRun: has precedence to all others and needs a second parameter which identify the command class to be executed
  • Interactive (i): starts an interactive session where the user can write code like in a REPL shell, optionally can be set JarList, NamespaceList and ImportList
  • Script (s): start a session to execute the script of the second parameter, optionally can be set JarList, NamespaceList and ImportList
  • NoLogo (nl): do not display initial informative string

Other options on Command line switch page.