Skip to content

Latest commit

 

History

History
96 lines (64 loc) · 3.11 KB

usageCLI.md

File metadata and controls

96 lines (64 loc) · 3.11 KB
title _description
CLI interface of .NET suite for Apache Kafka™
Describes how to use CLI interface of .NET suite for Apache Kafka™

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

Important

If the previous command raises the error described in Intel CET and KNet the only solution is to apply the following workaround (within an elevated shell) and disable CET:

	reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\knet.exe" /v MitigationOptions /t REG_BINARY /d "0000000000000000000000000000002000" /f
  • 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.