Exactly once delivery
Guarantee each record appears once on the target cluster.
Kafka's consumer protocol delivers each message at least once—a crash between writing a record and recording progress creates duplicates. If the target Kafka cluster must be a faithful copy of the source Kafka cluster, replication needs stronger guarantees than fire-and-forget produce and consume.
Enable features.exactlyOnce so K2K tracks progress in control topics on the target Kafka cluster rather than committing offsets on the source Kafka cluster; see Consumer group. The target producer must use idempotent writes (enable.idempotence and acks: all). For multiple instances, see Horizontal scaling. For commit batching, see Commit tuning. For assignment and fencing, see the Advanced section below.
Prerequisites
Consumer group configured
Topic selection and data routing configured
Example
Use the following pipeline configuration:
name: "my_pipeline"
features:
exactlyOnce: enabled
source:
kafka:
common:
"bootstrap.servers": "source:9092"
consumer:
"group.id": "my-k2k-group"
target:
kafka:
common:
"bootstrap.servers": "target:9092"
producer:
"enable.idempotence": "true"
"acks": "all"
replication:
- source:
topic: "orders.*"
- sink:
topic: source
partition: sourceConfiguration keys
Feature toggle
features.exactlyOnce
Exactly once delivery guarantee
No
disabled
Replicator
Target producer settings
Exactly once requires an idempotent producer on the target Kafka cluster. K2K sets these by default; override them under target.kafka.producer if needed.
target.kafka.producer."enable.idempotence"
true
Replicator
target.kafka.producer."acks"
all
Replicator
Advanced
Control topics and assignment
Assignment keys enforce exclusive assignment so only one replicator instance actively processes a given source partition at a time.
The commit control topic is configured under Consumer group. Control topic names can also be configured under topicCreation.control when auto creating topics.
coordination.assignment.topic
Control topic for exclusive assignment on the target Kafka cluster
No
__k2k_assignment
Replicator
coordination.assignment.graceWindow
Wait time before fencing other instances
No
15 seconds
Replicator
coordination.assignment.fencingMaxParallelism
Max parallelism when fencing producers
No
5
Replicator
coordination.commit.syncTimeout
Max wait when catching up on the commit control topic
No
90 seconds
Replicator
features.optimizeOffsetCommitPartition
Publish all control commit messages to a single partition per group
No
enabled
Replicator
Last updated
Was this helpful?

