Skip to main content

KAFKA::ADMIN

Perform admin operations on Kafka topics.

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

PropertyDescriptionType
<action-id>Unique identifier for the actionstring
typeType of the actionstring
propsProperties specific to this action. Refer to props section for more details.object

props

PropertyDescriptionTypeRequired
opTypeType of admin operation (LIST_TOPICS, CREATE_TOPIC, DELETE_TOPIC, DESCRIBE_TOPIC)stringtrue
topicTopic name for the operation (required for CREATE_TOPIC, DELETE_TOPIC, DESCRIBE_TOPIC)string
partitionCountNumber of partitions (only for CREATE_TOPIC)number
replicationFactorReplication 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

KeyDescriptionType
topicThe name of the topic related to the admin operation.string
timeTakenThe time taken to complete the admin operation, in milliseconds.long

DESCRIBE_TOPIC

KeyDescriptionType
descriptionDetailed information about the topic, including partitions and replicas.string

CREATE_TOPIC

KeyDescriptionType
createdIndicates whether the topic was successfully created.boolean

LIST_TOPICS

KeyDescriptionType
topicsA list of topic names currently available in the Kafka cluster.array

DELETE_TOPIC

KeyDescriptionType
deletedIndicates 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)"
}