kafka-sink-connector
Parent: mongodb-kafka-connector · researched 2026-05-28T16:41:44.341Z· 5 sources · 5 concepts · skill mongodb-kafka-connector
The MongoDB Connector for Apache Kafka is a Kafka Connect plugin that bridges MongoDB and Kafka in both directions:
Overview
- The MongoDB Connector for Apache Kafka is a Kafka Connect plugin that bridges MongoDB and Kafka in both directions: [source]
- Source connector: MongoDB change streams → Kafka topics (CDC pipeline) [source]
- Sink connector: Kafka topics → MongoDB collections (event consumer) [source]
- Supports Confluent Platform, Confluent Cloud, Amazon MSK, and self-managed Kafka. [source]
Basic Change Stream Source
- This publishes change events to topic mongo.mydb.orders (format: <prefix>.<db>.<collection>). [source]
Resume Token Persistence
Dead Letter Queue (DLQ)
Source Connector Errors
- ChangeStreamHistoryLost (error code 286): [source]
- The oplog has been truncated past the resume token. Resolution: [source]
- Set startup.mode=timestamp to start from a recent time [source]
- Or re-snapshot with startup.mode=copy_existing [source]
- Increase oplog size to prevent future occurrences [source]
- InvalidResumeToken: [source]
- Resume token is corrupted or from an incompatible MongoDB version. Resolution: clear stored offset and restart connector. [source]
Sink Connector Errors
Sink Connector
- Worker parallelism: Set tasks.max equal to the number of Kafka partitions for the topic. [source]
CDC Pipeline Pattern: MongoDB → Kafka → Downstream
Anti-Patterns
- Single-partition topics with multiple sink tasks: Multiple sink tasks on a single partition = contention; match tasks.max to partition count [source]
- Not configuring DLQ: Connector stops on first unprocessable message; always configure DLQ in production [source]
- InsertOneDefaultStrategy for idempotent pipelines: Insert fails on duplicate; use ReplaceOneDefaultStrategy or BulkWriteStrategy for idempotent sinks [source]
- Monitoring consumer lag but not resume token age: Consumer lag tells you about Kafka backlog; resume token age tells you about oplog risk (if token becomes invalid = full resync) [source]
- Not increasing oplog for high-volume CDC: Connector outage exceeding the oplog window = full resync required; size oplog to cover expected maintenance windows [source]
References
Children
- write-model-strategies (frontier)
- DLQ-error-handling (frontier)
- bulk-write-ordering (frontier)
Frontier under this node: DLQ-error-handling, bulk-write-ordering, write-model-strategies