Skip to content

Instantly share code, notes, and snippets.

@polster
Created January 3, 2022 22:17
Show Gist options
  • Save polster/a0f7c012a481ebca9a4e9d4e56e6eb39 to your computer and use it in GitHub Desktop.
Save polster/a0f7c012a481ebca9a4e9d4e56e6eb39 to your computer and use it in GitHub Desktop.
Kafka topics creation per make
#!make
KAFKA_BOOTSTRAP_SERVER=localhost:9092
KAFKA_TOPICS_FILE=./config/kafka/topics.txt
kafka-topics-create:
awk -F':' '{ system("kafka-topics.sh --create --bootstrap-server ${KAFKA_BOOTSTRAP_SERVER} --topic="$$1" --partitions="$$2" --replication-factor="$$3" --config="$$4) }' \
${KAFKA_TOPICS_FILE}
.PHONY: kafka-topics-create
# Explanation: topic name, partition count to be a multiple of the number of stream threads, replication count, policy
person-changed-events:10:1:cleanup.policy=compact
address-changed-events:10:1:cleanup.policy=compact
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment