Principle:Fede1024 Rust rdkafka Mock Topic Management
| Knowledge Sources | |
|---|---|
| Domains | Testing, Messaging |
| Last Updated | 2026-02-07 19:00 GMT |
Overview
A method for creating topics on a mock Kafka cluster as an alternative to automatic topic creation in testing scenarios.
Description
Mock Topic Management provides explicit topic creation on a mock cluster. Since the mock cluster's Admin API (CreateTopics) is not supported, topics must be created via the create_topic method. This gives test code full control over topic configuration including partition count and replication factor.
Usage
Use after creating a MockCluster and before configuring clients that will produce to or consume from the topic. This is the only way to create topics on a mock cluster.
Theoretical Basis
Pseudo-code logic:
// Abstract algorithm
cluster.create_topic("test-topic", num_partitions, replication_factor)
// Topic is now available for produce/consume