Monedula

Create topics

Create topics on the simulated cluster from a real client, with kafka-topics.sh, the Admin API or automatic creation, within the free-play caps.

How-to guides 3 of 4

2 min read

Updated 28 November 2026

Markdown

On this page

Topics you create through the bridge go through the playground’s own topic creation, the one the playground’s terminal uses for kafka-topics --create, so they appear on the canvas like any other topic and follow the same free-play caps.

Before you start

With kafka-topics.sh

bin/kafka-topics.sh --bootstrap-server 127.0.0.1:19092 \
  --create --topic clicks --partitions 3 --replication-factor 3

The command sends a CreateTopics request. Leave out --partitions or --replication-factor and the defaults apply: 1 partition, and a replication factor of 3 or the number of live brokers if that is lower.

To check a topic’s settings, describe its configs:

bin/kafka-configs.sh --bootstrap-server 127.0.0.1:19092 \
  --describe --entity-type topics --entity-name clicks

The answer lists the topic configs the playground models, with Kafka’s names and default flags.

With the Admin API

try (Admin admin = Admin.create(Map.of("bootstrap.servers", "127.0.0.1:19092"))) {
  admin.createTopics(List.of(
      new NewTopic("audit", 2, (short) 3).configs(Map.of("cleanup.policy", "compact"))
  )).all().get();
}

Configs the playground does not model are accepted and ignored. A validateOnly request runs the same checks and creates nothing.

By producing

A producer that writes to a topic that does not exist creates it with the defaults above, as a broker with automatic topic creation does. Use the Java client does this with payments.

When creation is refused

Error Why
POLICY_VIOLATION Over a free-play cap: at most 6 topics besides the one the session starts with, and a partition count the topology can draw. The message names the cap.
TOPIC_ALREADY_EXISTS A topic of that name exists.
INVALID_TOPIC_EXCEPTION A name Kafka refuses: longer than 249 characters, a character other than letters, digits, ., _ and -, or . or ... The message is Kafka’s.
INVALID_REPLICATION_FACTOR More replicas than live brokers.
INVALID_PARTITIONS Fewer than 1 partition.
INVALID_CONFIG A config the playground models, with a value its validation refuses, such as a cleanup.policy it does not know.

Topic creation works in free play only, which is the only mode that pairs with the bridge. While the playground is paused, a creation waits for Play.