Skip to content

Topic Retention Plugin

The topic-retention plugin filters out records that fall outside the target topic’s retention period.

When a topic’s restore task starts, the plugin reads the retention.ms property of the target topic and computes a cutoff timestamp as now - retention.ms. Any record with a timestamp before that cutoff is rejected and will not be restored. This is useful when you want to avoid restoring messages that Kafka would immediately discard upon ingestion.

apiVersion: kannika.io/v1alpha
kind: Restore
metadata:
name: restore-with-topic-retention
spec:
source: "source"
sink: "sink"
config:
plugins:
- name: topic-retention
topics:
- target: target-topic
source: source-topic

The plugin takes no configuration options.