#!/bin/sh # Idempotent broker topology + ACLs. Principals are certificate CNs (ssl.principal.mapping.rules). # dispatcher = producer only, worker = consumer of the jobs topic and of its own group only. Anybody else (even with a CA-signed cert) is denied. set -eu K=/opt/kafka/bin; B="--bootstrap-server kafka:9092 --command-config /client.properties" $K/kafka-topics.sh $B --create --if-not-exists --topic "$JOBS_TOPIC" --partitions 3 --replication-factor 1 --config min.insync.replicas=1 --config retention.ms=604800000 $K/kafka-acls.sh $B --add --allow-principal User:dispatcher --producer --idempotent --topic "$JOBS_TOPIC" $K/kafka-acls.sh $B --add --allow-principal User:worker --consumer --topic "$JOBS_TOPIC" --group attachment-workers $K/kafka-acls.sh $B --list