For the latest stable version, please use Korvet 0.12.5!

Topic Management

This guide covers creating and managing topics in Korvet.

Creating Topics

Automatic Topic Creation

By default, topics are automatically created when you first produce to them or request metadata for them. This behavior can be controlled with the auto-create-topics configuration:

korvet:
  server:
    topic-registry:
      auto-create-topics: true  # Enable/disable automatic topic creation (default: true)
      default-partitions: 1     # Default partitions for auto-created topics (default: 1)

When auto-creation is disabled, you must explicitly create topics before using them.

Explicit Topic Creation

You can create topics explicitly using the Kafka command-line tools:

kafka-topics --bootstrap-server localhost:9092 \
  --create \
  --topic my-topic \
  --partitions 3 \
  --replication-factor 1
The replication-factor parameter is accepted for compatibility but ignored, as Korvet uses Redis for storage and replication.

Listing Topics

List all topics:

kafka-topics --bootstrap-server localhost:9092 --list

Describing Topics

Get details about a topic:

kafka-topics --bootstrap-server localhost:9092 \
  --describe \
  --topic my-topic

Deleting Topics

Delete a topic:

kafka-topics --bootstrap-server localhost:9092 \
  --delete \
  --topic my-topic

Topic Configuration

Topics can be configured with:

  • Partitions: Number of partitions for parallelism

  • Retention: How long messages are kept in hot storage

  • Compression: Compression codec (none, gzip, snappy, lz4, zstd)

Configuring Compression

Set compression type for a topic:

kafka-configs --bootstrap-server localhost:9092 \
  --entity-type topics \
  --entity-name my-topic \
  --alter \
  --add-config compression.type=lz4

View current compression configuration:

kafka-configs --bootstrap-server localhost:9092 \
  --entity-type topics \
  --entity-name my-topic \
  --describe

Available compression types:

  • none - No compression (default)

  • gzip - Good compression ratio, higher CPU usage

  • snappy - Balanced compression and speed

  • lz4 - Fast compression, lower CPU usage

  • zstd - Best compression ratio, moderate CPU usage

See Compression for more details on how compression works in Korvet.