Create and delete Kafka topics from an AsyncAPI document
One topic is missing, another one is extra. What gets created, and what gets deleted?

The recording shows kurkik kafka sync on the demo sandbox; its data differs from this example.
The plan
Section titled “The plan”Nothing changes yet. --dry-run only shows what would happen.
$ kurkik kafka sync a.yaml b --delete --dry-runSync a.yaml into b - Apache Kafka, cluster MkU3OEVBNTcwNTJENDM2Qkowns: the whole cluster - the document names no x-kurkik.kafka.server.topicPrefixes; access, as x-kurkik.kafka.server.acl declares itplan: <digest>Run one sync per cluster at a time: two at once each plan against a state the other is changing.
changes (2) + create payments.settled - delete legacy.events [destroys messages] Every message in legacy.events is deleted, and every consumer group's position in it. note: Kafka deletes topics asynchronously: the name can stay taken for a while. A recreation waits up to 60s, and if the create fails after the delete, the rollback holds the topic's definition. note: A cluster with delete.topic.enable=false refuses every deletion; nothing is lost when it does.
left alone (6) not decided orders.created groupId Nothing about this can be checked against the system, so sync cannot bring it into line. Operation 'receive_orders.created' declares no consumer group, so there is nothing a broker could confirm. not decided receive_payments.settled groupId Nothing about this can be checked against the system, so sync cannot bring it into line. Operation 'receive_payments.settled' declares no consumer group, so there is nothing a broker could confirm. not decided orders.created action Nothing about this can be checked against the system, so sync cannot bring it into line. A broker cannot know who publishes to 'orders.created', so operation 'send_orders.created' is not checked. not decided send_payments.settled action Nothing about this can be checked against the system, so sync cannot bring it into line. A broker cannot know who publishes to 'payments.settled', so operation 'send_payments.settled' is not checked. and 2 differences sync does not act on - servers, messages, undeclared settings; kurkik kafka diff shows them
applying needs: DESCRIBE and DESCRIBE_CONFIGS on the topics it reads; CREATE on TOPIC payments.settled (or on the CLUSTER); DELETE on TOPIC legacy.events
2 changes, 1 destroy
rehearsal [?] not attempted delete legacy.events not rehearsed: a dry run sends no deletion [+] done create payments.settled
The cluster would accept every request it was shown. 1 could not be rehearsed - Kafka has no validate-only deletion or ACL change, and a schema registry no validate-only write. Nothing was changed.exit 2$ kurkik kafka sync a.yaml b --delete --yesSync a.yaml into b - Apache Kafka, cluster MkU3OEVBNTcwNTJENDM2Qkowns: the whole cluster - the document names no x-kurkik.kafka.server.topicPrefixes; access, as x-kurkik.kafka.server.acl declares itplan: <digest>Run one sync per cluster at a time: two at once each plan against a state the other is changing.
changes (2) + create payments.settled - delete legacy.events [destroys messages] Every message in legacy.events is deleted, and every consumer group's position in it. note: Kafka deletes topics asynchronously: the name can stay taken for a while. A recreation waits up to 60s, and if the create fails after the delete, the rollback holds the topic's definition. note: A cluster with delete.topic.enable=false refuses every deletion; nothing is lost when it does.
left alone (6) not decided orders.created groupId Nothing about this can be checked against the system, so sync cannot bring it into line. Operation 'receive_orders.created' declares no consumer group, so there is nothing a broker could confirm. not decided receive_payments.settled groupId Nothing about this can be checked against the system, so sync cannot bring it into line. Operation 'receive_payments.settled' declares no consumer group, so there is nothing a broker could confirm. not decided orders.created action Nothing about this can be checked against the system, so sync cannot bring it into line. A broker cannot know who publishes to 'orders.created', so operation 'send_orders.created' is not checked. not decided send_payments.settled action Nothing about this can be checked against the system, so sync cannot bring it into line. A broker cannot know who publishes to 'payments.settled', so operation 'send_payments.settled' is not checked. and 2 differences sync does not act on - servers, messages, undeclared settings; kurkik kafka diff shows them
applying needs: DESCRIBE and DESCRIBE_CONFIGS on the topics it reads; CREATE on TOPIC payments.settled (or on the CLUSTER); DELETE on TOPIC legacy.events
2 changes, 1 destroy
applied [+] done create payments.settled [+] done delete legacy.events
Applied 2 of 2 changes - 6 left alonesnapshot: ~/.local/state/kurkik/sync/b/b-<time>.snapshot.yamlrollback: ~/.local/state/kurkik/sync/b/b-<time>.rollback.yamlundo: kurkik kafka sync revert ~/.local/state/kurkik/sync/b/b-<time>.snapshot.yamlexit 0Rollback file
Section titled “Rollback file”Written before the first change.
rollback.yaml
system: "Apache Kafka"target: "MkU3OEVBNTcwNTJENDM2Qk"createdAt: "<time>"document: "~/.local/state/kurkik/sync/b/b-<time>.snapshot.yaml"entries:- forAction: "create-channel:payments.settled" undo: "DELETE_CREATED_CHANNEL" target: "payments.settled" note: "sync created this. Undoing it deletes the channel and whatever was written\ \ to it since."- forAction: "delete-channel:legacy.events" undo: "RECREATE_DELETED_CHANNEL" target: "legacy.events" note: "sync deleted this. It can be made again as it was; its messages cannot." definition: partitions: "3" replicas: "1"Revert
Section titled “Revert”$ kurkik kafka sync revert ~/.local/state/kurkik/sync/b/b-<time>.snapshot.yaml b --force --yesRevert b to b-<time>.snapshot.yaml - Apache Kafka, cluster MkU3OEVBNTcwNTJENDM2Qkowns: what the run being undone changed, as its rollback records itplan: <digest>Run one sync per cluster at a time: two at once each plan against a state the other is changing.
changes (2) + create legacy.events - delete payments.settled [destroys messages] Every message written to payments.settled since sync created it is deleted. note: Kafka deletes topics asynchronously: the name can stay taken for a while. A recreation waits up to 60s, and if the create fails after the delete, the rollback holds the topic's definition. note: A cluster with delete.topic.enable=false refuses every deletion; nothing is lost when it does.
applying needs: DESCRIBE and DESCRIBE_CONFIGS on the topics it reads; CREATE on TOPIC legacy.events (or on the CLUSTER); DELETE on TOPIC payments.settled
2 changes, 1 destroy
applied [+] done create legacy.events [+] done delete payments.settled
Applied 2 of 2 changessnapshot: ~/.local/state/kurkik/sync/b/b-<time>.snapshot.yamlrollback: ~/.local/state/kurkik/sync/b/b-<time>.rollback.yamlundo: kurkik kafka sync revert ~/.local/state/kurkik/sync/b/b-<time>.snapshot.yamlexit 0After the revert, compared with how it was before: Drift: 0 changed · 0 unmanaged · 0 missing (no drift) - 20 matched
The documents
Section titled “The documents”source.yaml, 113 lines
asyncapi: 3.0.0info: title: a Apache Kafka API version: 1.0.0-SNAPSHOT description: "Generated by reading the a cluster. Cluster id: MkU3OEVBNTcwNTJENDM2Qk."servers: broker-1: host: a-kafka-1:9092 protocol: kafka protocolVersion: "4.4" x-kurkik: kafka: server: security: - security: PLAINTEXT securityProtocol: PLAINTEXT acl: [] groups: [] brokerConfiguration: advertised.listeners: "INTERNAL://kafka-1:19092,EXTERNAL://a-kafka-1:9092" authorizer.class.name: org.apache.kafka.metadata.authorizer.StandardAuthorizer broker.id: "1" controller.listener.names: CONTROLLER controller.quorum.voters: 1@kafka-1:9093 group.initial.rebalance.delay.ms: "0" inter.broker.listener.name: INTERNAL listener.security.protocol.map: "INTERNAL:PLAINTEXT,EXTERNAL:PLAINTEXT,CONTROLLER:PLAINTEXT" listeners: "INTERNAL://0.0.0.0:19092,EXTERNAL://0.0.0.0:9092,CONTROLLER://0.0.0.0:9093" min.insync.replicas: "1" node.id: "1" offsets.topic.replication.factor: "1" process.roles: "broker,controller" transaction.state.log.min.isr: "1" transaction.state.log.replication.factor: "1" clientConfiguration: bootstrap.servers: a-kafka-1:9092 security.protocol: PLAINTEXT groupConfiguration: {} producerConfiguration: {} consumerConfiguration: {}channels: orders.created: address: orders.created bindings: kafka: bindingVersion: 0.5.0 partitions: 3 replicas: 1 topicConfiguration: retention.ms: 604800000 x-kurkik: kafka: channel: topic: orders.created partitions: 3 replicas: 1 topicConfiguration: retention.ms: "604800000" payments.settled: address: payments.settled bindings: kafka: bindingVersion: 0.5.0 partitions: 3 replicas: 1 x-kurkik: kafka: channel: topic: payments.settled partitions: 3 replicas: 1 topicConfiguration: min.insync.replicas: "1" retention.bytes: "10737418240"operations: receive_orders.created: action: receive channel: $ref: "#/channels/orders.created" x-kurkik: kafka: operation: security: [] consumerConfiguration: {} groupConfiguration: {} receive_payments.settled: action: receive channel: $ref: "#/channels/payments.settled" x-kurkik: kafka: operation: security: [] consumerConfiguration: {} groupConfiguration: {} send_orders.created: action: send channel: $ref: "#/channels/orders.created" x-kurkik: kafka: operation: security: [] producerConfiguration: {} send_payments.settled: action: send channel: $ref: "#/channels/payments.settled" x-kurkik: kafka: operation: security: [] producerConfiguration: {}How to build this setup yourself
Brokers
Cluster a
kafka-topics.sh --bootstrap-server a-kafka-1:9092 --create --topic orders.created --partitions 3 --replication-factor 1 --config retention.ms=604800000kafka-topics.sh --bootstrap-server a-kafka-1:9092 --create --topic payments.settled --partitions 3 --replication-factor 1 --config min.insync.replicas=1 --config retention.bytes=10737418240Cluster b
kafka-topics.sh --bootstrap-server b-kafka-1:9092 --create --topic orders.created --partitions 3 --replication-factor 1 --config retention.ms=604800000kafka-topics.sh --bootstrap-server b-kafka-1:9092 --create --topic legacy.events --partitions 3 --replication-factor 1Sync
kurkik conn add kafka a --bootstrap a-kafka-1:9092kurkik conn add kafka b --bootstrap b-kafka-1:9092kurkik kafka export a --acls --groups --stdout > a.yaml # source.yamlkurkik kafka sync a.yaml b --delete --dry-run # plan.txt (and -o json: plan.json)kurkik kafka sync a.yaml b --delete --yes # apply.txt, and the rollback: rollback.yamlkurkik kafka sync revert ~/.local/state/kurkik/sync/b/b-<time>.snapshot.yaml b --force --yes # revert.txtAll flags: kurkik kafka sync · more Apache Kafka sync examples
Copyright © 2026 Pavel Bodiachevskii