Quick revision
The short answer
For a source connector, the task's poll() returns SourceRecords, transforms run in order with optional predicates, the key, value and header converters serialize to bytes, the worker's producer sends them, and source offsets are flushed to the offsets topic periodically. A sink runs the same stages in reverse, ending in the task's put(), with consumer offsets committed after flush. errors.tolerance covers the converter and transform stages, and SMTs should not call external services because they run synchronously on the task thread with no durable state.
What to remember
In this answer, we followed a source record from poll() through transforms and predicates, converters and the producer, with offsets flushed periodically to the offsets topic, and a sink record from the consumer through converters and transforms to put(), with offsets committed after flush and preCommit. errors.tolerance covers converters and transforms, the DLQ exists only for sinks and also takes records reported through ErrantRecordReporter, and exceptions from poll() or put() are the connector's responsibility. Transforms must stay cheap and stateless, and they work on Connect data, so they are independent of the wire format.
Your turn
Answer it aloud as you would in the interview, or type your answer below. Then show one part at a time and compare.
For a source connector, the task's poll() returns SourceRecords, transforms run in order with optional predicates, the key, value and header converters serialize to bytes, the worker's producer sends them, and source offsets are flushed to the offsets topic periodically. A sink runs the same stages in reverse, ending in the task's put(), with consumer offsets committed after flush. errors.tolerance covers the converter and transform stages, and SMTs should not call external services because they run synchronously on the task thread with no durable state.
Why this question is asked
Most Connect failures are easier to diagnose once we know which stage a record was in when it failed, because each stage fails differently and is governed by different settings. Interviewers ask this internals question to see whether we have that mental map, and whether we understand why some designs, like HTTP lookups in a transform, are fragile. In this answer, we will follow a record through a source connector, then through a sink connector, mark which stages errors.tolerance protects, and explain why transforms must stay cheap and stateless.
1The Path of a Source Record
A source task's poll() method reads from the external system and returns a list of SourceRecords. Each holds Connect data, values with Connect schemas rather than bytes, plus the target topic and the source partition and source offset that describe how far the task has read.
The worker then runs the transforms listed in the connector's transforms setting, one after another, each optionally guarded by a predicate that decides whether it applies to this record. Next the key converter, value converter and header converter turn the key, value and headers into bytes; this is the only place the wire format is decided. The worker's producer sends the bytes to Kafka. Separately, every offset.flush.interval.ms (60 seconds by default), the worker writes the source offsets of records that Kafka has acknowledged to the offsets topic, so a restarted task resumes from there.
- Task poll()
SourceRecordswith Connect schemas - Transforms in ordereach with an optional predicate
- Key, value, header convertersConnect data -> bytes
- Worker producer sendsto the target topic
- Offsets flushed periodicallyoffsets topic,
offset.flush.interval.ms
5 steps in order. Play them, or step through them one at a time.
2The Path of a Sink Record
A sink runs the same stages in the opposite direction. The worker's consumer fetches bytes from the subscribed topics. The converters turn key, value and headers into Connect data. The transforms run in order. Then the worker hands a batch to the task's put() method, which writes it to the external system, often buffering.
Offsets are committed to the consumer group after a flush. Before committing, the worker calls the task's preCommit(), which by default flushes and returns the current offsets. A connector that writes asynchronously, such as one that builds files for object storage, overrides preCommit to return only the offsets it has written durably, so Kafka never records progress the target does not have.
- Worker consumer fetches bytesconsumer group connect-<name>
- Convertersbytes -> Connect data
- Transforms in orderwith optional predicates
- Task put()writes or buffers the batch
- preCommit, then offset commitonly what is durably written
5 steps in order. Play them, or step through them one at a time.
3Which Stages errors.tolerance Covers
Connect's error handling settings, errors.tolerance, errors.retry.timeout and errors.log.enable, apply to the stages the framework itself runs: converters and transforms. With errors.tolerance=all, a record that fails conversion or a transform is skipped (and logged, if logging is enabled) instead of failing the task. errors.retry.timeout controls how long retriable errors in those stages are retried.
The dead letter queue exists only for sink connectors: errors.deadletterqueue.topic.name sends failed records, with headers describing the error if we enable them. A sink task can also report a record it could not write by calling ErrantRecordReporter, and those records go to the same DLQ. What is not covered is the connector's own code: an exception thrown from poll() or put() is the connector's responsibility, and unless the connector handles it, it usually fails the task. This is why a database error in a sink often fails the task even with errors.tolerance=all.
| Stage | errors.tolerance applies? | Failed record can go to |
|---|---|---|
Source task poll() | No | task fails (connector's job to handle) |
| Transforms and predicates | Yes | skipped and logged (source); DLQ (sink) |
| Converters | Yes | skipped and logged (source); DLQ (sink) |
Sink task put() | No, unless the task reports it | DLQ via ErrantRecordReporter |
4Why Transforms Must Stay Cheap and Stateless
A single message transform is called synchronously, once per record, on the task's own thread. If it makes an HTTP call to look up customer data and that service takes 200 ms, the task processes at most about five records per second, and if the service goes down, the connector stalls. The pipeline's throughput and availability are now tied to another team's service.
Transforms also keep no durable state and do not take part in offset commits. After a restart or a rebalance, records since the last committed offset are processed again, so the lookup happens again, possibly returning a different answer. Any in-memory cache or dedup set is lost when the task moves. So enrichment, joins and stateful logic belong in a stream processor like Kafka Streams or Flink, which has durable state and proper failure handling, writing to an enriched topic the connector then reads.
5Why the Same Transform Works With Any Format
Because transforms operate on Connect data, values with Connect schemas, rather than on bytes, a transform like MaskField or InsertField works the same whether the topic holds JSON, Avro or Protobuf. The converter alone decides the wire format and whether a schema registry is used. That separation is useful: we can change a pipeline from JSON to Avro by changing converters, without touching the transforms.
6Follow-up questions
What does offset.flush.interval.ms trade off for a source connector?
It sets how often the worker records source offsets. A shorter interval means less data is re-read and re-sent after a crash, since the task resumes from the last flushed offset, but more frequent writes to the offsets topic and more frequent flush work for the producer. A longer interval reduces overhead but increases the duplicates produced after a failure. The default of 60 seconds is a reasonable middle for most connectors.
Where do header converters fit?
Next to the key and value converters. For a source they serialize the record's Connect headers to bytes; for a sink they turn header bytes into Connect header values. The default, SimpleHeaderConverter, handles simple types and strings.
Does the DLQ exist for source connectors?
No. Source connectors can tolerate and log conversion and transform errors, but there is no dead letter queue for them, because the records never reached Kafka in a form a DLQ could hold.
7Conclusion
In this answer, we followed a source record from poll() through transforms and predicates, converters and the producer, with offsets flushed periodically to the offsets topic, and a sink record from the consumer through converters and transforms to put(), with offsets committed after flush and preCommit. errors.tolerance covers converters and transforms, the DLQ exists only for sinks and also takes records reported through ErrantRecordReporter, and exceptions from poll() or put() are the connector's responsibility. Transforms must stay cheap and stateless, and they work on Connect data, so they are independent of the wire format.
Open with
For a source connector, the task's poll() returns SourceRecords holding Connect schemas and values plus a source partition and offset. The worker runs the transforms in order, each optionally guarded by a predicate, then the key, value and header converters serialize to bytes, and the worker's producer sends them.
Then, if they want more
Source offsets are committed to the offsets topic periodically, every offset.flush.interval.ms. For a sink it is the reverse: the worker's consumer fetches bytes, converters turn key, value and headers into Connect data, transforms run, and the task's put() receives the batch.
Consumer offsets are committed after flush, and preCommit lets the connector say how far it has written durably. errors.tolerance, errors.retry.timeout and errors.log.enable apply to the converter and transform stages. The dead letter queue exists only for sinks and also takes records a task reports through ErrantRecordReporter. Exceptions from poll() or put() are the connector's responsibility and usually fail the task.
Transforms should not call external services because they run synchronously per record on the task thread with no durable state, so a slow service stalls the connector and the call repeats on redelivery; enrichment belongs in a stream processor. And since transforms work on Connect data, the same transform works with JSON, Avro or Protobuf.
About this answer
- Last updated
- 13 November 2026
- Checked
- Its structure and format are checked automatically. Use it as a carefully prepared study note: where a detail matters, confirm it against the documentation below. What the checks cover
- Where the question comes from
- Written by Scrivio for practice. It is not taken from an interview.
- Official documentation
- Apache Kafka documentation
Report an issue with this answer
Copy the line below and send it to the author with what you found. It carries the address of this page.
Issue with "Describe the path of a record through Kafka Connect for a source connector and for a...": https://scrivio-interview-library.netlify.app/spring-boot/kafka-streams-connect/b39f7844cc/