For the complete documentation index, see llms.txt. This page is also available as Markdown.

Exactly once delivery

Guarantee each record appears once on the target cluster.

This feature is disabled by default. Set the corresponding features toggle to enabled in your pipeline file for the behavior described on this page to take effect.

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

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: source

Configuration keys

Feature toggle

Key
Description
Required
Default
Used by

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.

Key
Required value
Used by

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.

Key
Description
Required
Default
Used by

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?