Link Search Menu Expand Document

Examples

Table of contents

  1. Command Examples
  2. File Examples
    1. Human Readable to Create a Topic
    2. Human Readable to Path a Topic

Examples of how to use topic migrations.

Command Examples

All examples are based on these file examples

Set the directory with migrations using the --directory option:

kattlo \
  --config-file='examples/.kattlo.yaml' \
  --kafka-config-file='examples/kafka.properties' \
  topic \
  --directory='examples/topics/01_create_with_config'

Directory with migrations will be default to current, when --directory is suppressed:

kattlo \
  --config-file='examples/.kattlo.yaml' \
  --kafka-config-file='examples/kafka.properties' \
  topic

The current directory contains kafka.properties and .kattlo.yaml:

kattlo \
  topic \
  --directory='examples/topics/01_create_with_config'

Want to use the kafka.properties, but in another cluster:

kattlo \
  --config-file='examples/.kattlo.yaml' \
  --kafka-config-file='examples/kafka.properties' \
  --bootstrap-servers='my.kafka:9092' \
  topic \
  --directory='examples/topics/01_create_with_config'

The option --bootstrap-servers overrides the config bootstrap.servers.

Showing topic current state:

Include the option --format=JSON to printout json instead plain text

kattlo \
  --config-file='examples/.kattlo.yaml' \
  --kafka-config-file='examples/kafka.properties' \
  info --resource=TOPIC \
  '<topic-name>'

Showing topic history:

Include the option --format=JSON to printout json instead plain text

kattlo \
  --config-file='examples/.kattlo.yaml' \
  --kafka-config-file='examples/kafka.properties' \
  info --resource=TOPIC --history \
  '<topic-name>'

File Examples

Human Readable to Create a Topic

operation: create
notes: |
  This is a multiline
  notes about 
topic: my-topic-name
config:
  compression.type: gzip
  cleanup.policy  : compact
  segment.bytes: 900MiB
  max.compaction.lag.ms: 2days
  delete.retention.ms: 10minutes
  flush.ms: 12hours

Human Readable to Path a Topic

operation: patch
notes: Add new configurtions
topic: 10_human_readable
config:
  delete.retention.ms: 0
  max.message.bytes: 950KiB
  retention.ms: 2days
  message.timestamp.type: LogAppendTime