usage: kafka --service-key <service key> [ --alter --topic <topic-name> --partitions <number of partitions>], [ --create --topic <topic-name> --partitions <number of partitions> --replication-factor <number of replications>], [ --delete --topic <topic name>], [ --describe [--topic <topic-name-regexp>]], [ --list] [--topic <topic-name-regexp>], [ --verbose-on-error]
The kafka
command enables you to configure your embedded Kafka. If you are using multiple or non-default Kafka embedded in, you use kafka --service-key <service key>
to specify the Kafka Service Key.
Note!
You must specify the relevant embedded service key when you call the kafka
command.
For further information on using embedded Kafka, refer to 9.49.1.1 Quick Start of Embedded Kafka in the Desktop user's guide.
The command accepts the following options:
| This option allows you to add partitions to a topic. It is impossible to remove partitions. For further information on the arguments you can alter, refer to http://kafka.apache.org/082/documentation.html. |
| You create your Kafka configuration using this option. You use this action to determine the name of the topic, how many partitions there are in the topic, and the replication factor for each partition. See the For further information on the arguments you can create, refer to http://kafka.apache.org/082/documentation.html. |
| You use this option to delete a topic. |
[--describe [--topic <topic-name-regexp>]] | This option provides a description of all the topics that have been created, or you can specify for which topic you want to view the description. See the
For further information on the arguments, for which you can display a description, refer to http://kafka.apache.org/082/documentation.html. |
[--list [--topic <topic-name-regexp>]] | A list of all the topics is provided, or you can specify a topic. |
[ --verbose-on-error] | If you are using Kafka embedded in , you use this option to display the stack trace information in more detail when an error occurs. |
Example - Using the --create action
Creates a topic with the name test1-topic
, with three partitions and a replication factor of one:
$ kafka --service-key kafka1 --create --topic test1-topic --partitions 3 --replication-factor 1
Example - Using the --describe action
$ kafka --service-key kafka1 --describe --topic test1-topic
Provides the following output:
Topic:test1-topic PartitionCount:3 ReplicationFactor:1 Configs Topic: test1-topic Partition: 0 Leader: 1 Replicas: 1 Isr: 1 Topic: test1-topic Partition: 1 Leader: 2 Replicas: 2 Isr: 2 Topic: test1-topic Partition: 2 Leader: 3 Replicas: 3 Isr: 3
Return Codes
Listed below are the different return codes for the kafka
command:
Code | Description |
---|---|
0 | Will be returned if the command is successful. |
1 | Will be returned if a syntax error has occurred. |
127 | Will be returned if an internal Kafka error has occurred. |