KAFKA::ADMIN
Perform admin operations on Kafka topics.
Prerequisite
Syntax
actions:
<action-id>:
type: KAFKA::ADMIN
props:
opType: <operation_type>
topic: <topic_name> # Optional based on operation
partitionCount: <count> # For CREATE_TOPIC
replicationFactor: <factor> # For CREATE_TOPIC
Properties
Property | Description | Type |
---|---|---|
<action-id> | Unique identifier for the action | string |
type | Type of the action | string |
props | Properties specific to this action. Refer to props section for more details. | object |
props
Property | Description | Type | Required |
---|---|---|---|
opType | Type of admin operation (LIST_TOPICS, CREATE_TOPIC, DELETE_TOPIC, DESCRIBE_TOPIC) | string | true |
topic | Topic name for the operation (required for CREATE_TOPIC, DELETE_TOPIC, DESCRIBE_TOPIC) | string | |
partitionCount | Number of partitions (only for CREATE_TOPIC) | number | |
replicationFactor | Replication factor (only for CREATE_TOPIC) | number |
Example
List Topics
actions:
listTopics:
type: KAFKA::ADMIN
props:
opType: LIST_TOPICS
Create Topic
actions:
createTopic:
type: KAFKA::ADMIN
props:
opType: CREATE_TOPIC
topic: "new_topic"
partitionCount: 3
replicationFactor: 1
Delete Topic
actions:
deleteTopic:
type: KAFKA::ADMIN
props:
opType: DELETE_TOPIC
topic: "old_topic"
Describe Topic
actions:
describeTopic:
type: KAFKA::ADMIN
props:
opType: DESCRIBE_TOPIC
topic: "existing_topic"
Output
📝 Note: Can be accessed using
context["last_output"]
Common
Key | Description | Type |
---|---|---|
topic | The name of the topic related to the admin operation. | string |
timeTaken | The time taken to complete the admin operation, in milliseconds. | long |
DESCRIBE_TOPIC
Key | Description | Type |
---|---|---|
description | Detailed information about the topic, including partitions and replicas. | string |
CREATE_TOPIC
Key | Description | Type |
---|---|---|
created | Indicates whether the topic was successfully created. | boolean |
LIST_TOPICS
Key | Description | Type |
---|---|---|
topics | A list of topic names currently available in the Kafka cluster. | array |
DELETE_TOPIC
Key | Description | Type |
---|---|---|
deleted | Indicates whether the topic was successfully deleted. | boolean |
Example
List Topics
{
"topics": ["topic2", "test-topic1", "example-topic"],
"timeTaken": 128
}
Create Topic
{
"topic": "example-topic",
"created": true,
"timeTaken": 632
}
Delete Topic
{
"topic": "example-topic",
"deleted": true,
"timeTaken": 193
}
Describe Topic
{
"topic": "example_topic",
"timeTaken": 140,
"description": "(name=example_topic, internal=false, partitions=(partition=0, leader=localhost:9092 (id: 1001 rack: null), replicas=localhost:9092 (id: 1001 rack: null), isr=localhost:9092 (id: 1001 rack: null)), authorizedOperations=null)"
}