Principle:Apache Kafka Topic CLI Bootstrap
| Knowledge Sources | |
|---|---|
| Domains | Administration, CLI_Tools |
| Last Updated | 2026-02-09 12:00 GMT |
Overview
A connection bootstrap process that initializes the Kafka AdminClient through the topic command-line interface.
Description
Topic CLI Bootstrap establishes a connection from the command-line tool to a Kafka cluster by parsing arguments, creating an Admin client with the specified bootstrap server, and routing to the appropriate sub-command (create, list, describe, alter, delete). The kafka-topics.sh script delegates to the TopicCommand Java class which handles argument parsing and Admin client lifecycle.
Usage
Use this principle whenever interacting with Kafka topics from the command line. It is the entry point for all topic management operations.
Theoretical Basis
The bootstrap follows a command-routing pattern:
- Argument Parsing: Parse command-line options into a TopicCommandOptions object.
- Admin Client Creation: Create a TopicService with an Admin client connected to the bootstrap server.
- Command Routing: Route to the appropriate operation based on the specified sub-command flag.
- Resource Cleanup: Close the Admin client after the operation completes.