Kafka with Python
This chapter implements safe Python producers and consumers with delivery callbacks, manual commits, retry/DLT envelopes, asynchronous integration, schemas, and compatible event evolution.
- Explain confluent-kafka & kafka-python by naming its input, guarantee, internal lifecycle, important failure, and proof.
- Explain Error handling & DLQ by naming its input, guarantee, internal lifecycle, important failure, and proof.
- Explain Schema Registry & Avro by naming its input, guarantee, internal lifecycle, important failure, and proof.
- Explain Producer & consumer modes by naming its input, guarantee, internal lifecycle, important failure, and proof.
- Trace the chapter's complete execution path and identify where memory, I/O, concurrency, persistence, or rendering cost accumulates.
How to use this chapter
For Kafka with Python, read the explanations first and predict every example before running it. Keep a learning repository containing code, tests, command output, and the short written submission. The roadmap checklist at the end audits coverage; the chapter itself follows the distributed learning arc appropriate to this subject.
The problem this chapter solves
This chapter implements safe Python producers and consumers with delivery callbacks, manual commits, retry/DLT envelopes, asynchronous integration, schemas, and compatible event evolution.
It decouples services in time, supports high-throughput event streams, and lets multiple independent consumer groups derive different views from the same facts.
Learning outcomes
- Explain confluent-kafka & kafka-python by naming its input, guarantee, internal lifecycle, important failure, and proof.
- Explain Error handling & DLQ by naming its input, guarantee, internal lifecycle, important failure, and proof.
- Explain Schema Registry & Avro by naming its input, guarantee, internal lifecycle, important failure, and proof.
- Explain Producer & consumer modes by naming its input, guarantee, internal lifecycle, important failure, and proof.
- Trace the chapter's complete execution path and identify where memory, I/O, concurrency, persistence, or rendering cost accumulates.
- Build the worked example, make one failure visible, and defend the design in a review.
Chapter progression
The order below is intentional: later sections depend on guarantees established earlier.
Runtime or system overview
A record key is mapped to a partition, sent to that partition's leader, appended to the log, and replicated to followers. A consumer group assigns each partition to at most one active member. Offsets are application progress, not record identities. Durability depends on acknowledgments, replication, ISR, and broker settings working together. In Kafka with Python, use that execution model to decide where the chapter's validation, state ownership, cleanup, and evidence belong.
Execution trace
- The producer validates and serializes a versioned record, hashes its key to a partition, batches it, and sends it to that partition's leader under the configured acknowledgment policy.
- The broker appends the record at the next partition offset and replicates it; durability depends on acknowledgments, in-sync replicas, and minimum-ISR settings together.
- A group member polls assigned partitions, deserializes the record, checks event identity, and performs its bounded idempotent side effect.
- Recoverable progress advances only after the corresponding effect is durable, or a Kafka transaction atomically publishes output and offsets for Kafka-to-Kafka work.
- Tests inject duplicate delivery, rebalance, poison data, broker interruption, and lag while asserting ordering only within the declared key scope.
Memory and performance lens
Producers batch records in client buffers; consumers fetch batches into memory. Oversized messages, unlimited in-flight requests, slow processing, and large poll batches cause pressure. Broker page cache is central to throughput; Kafka is designed around sequential disk I/O and zero-copy transfer where possible. For Kafka with Python, connect those costs to the concrete operations in the topic sections rather than assuming the friendly surface syntax is cheap.
When tuning Kafka with Python, measure publish-to-complete latency, retries, duplicate effects, oldest work age, queue depth or partition lag, throughput, and recovery time rather than optimizing from source-code appearance.
1. confluent-kafka & kafka-python
The confluent-kafka & kafka-python unit begins with Producer/Consumer/AdminClient: Python clients expose Kafka's producer accumulator, consumer poll loop, and administrative APIs with different performance and async trade-offs. Treat callback errors as delivery outcomes and close consumers gracefully. The rest of this section connects that guarantee to this unit's related roadmap concepts instead of treating each term as an isolated flashcard.
Guarantees before APIs: confluent-kafka & kafka-python
| Concept | Meaning | Engineering decision |
|---|---|---|
| Producer/Consumer/AdminClient | Python clients expose Kafka's producer accumulator, consumer poll loop, and administrative APIs with different performance and async trade-offs. | Treat callback errors as delivery outcomes and close consumers gracefully. |
| AIOKafka for async consumers | Python clients expose Kafka's producer accumulator, consumer poll loop, and administrative APIs with different performance and async trade-offs. | Treat callback errors as delivery outcomes and close consumers gracefully. |
| delivery reports and callbacks | Python clients expose Kafka's producer accumulator, consumer poll loop, and administrative APIs with different performance and async trade-offs. | Treat callback errors as delivery outcomes and close consumers gracefully. |
Message and failure lifecycle: confluent-kafka & kafka-python
Producer/Consumer/AdminClient. confluent-kafka delegates protocol work to librdkafka background threads; callbacks are served when the application polls or flushes.
AIOKafka for async consumers. confluent-kafka delegates protocol work to librdkafka background threads; callbacks are served when the application polls or flushes.
delivery reports and callbacks. confluent-kafka delegates protocol work to librdkafka background threads; callbacks are served when the application polls or flushes.
Read these as one system: Producer/Consumer/AdminClient establishes the starting contract, AIOKafka for async consumers changes how that contract is executed or represented, and delivery reports and callbacks exposes a later boundary or failure condition. A local optimization is useful only when the combined behavior stays correct and observable.
A recoverable implementation slice: confluent-kafka & kafka-python
1producer.produce("events", key=entity_id, value=payload, on_delivery=delivered)This confluent-kafka & kafka-python slice makes Producer/Consumer/AdminClient observable. Read it from the boundary inward: identify the input, the validation point, the state or operation, and the value that proves the result. Before extending it toward delivery reports and callbacks, predict its behavior for empty, invalid, repeated, and large input.
Duplicate, ordering, and outage traps: confluent-kafka & kafka-python
| Risk | Why it matters |
|---|---|
| Producer/Consumer/AdminClient | Calling flush after every message destroys batching. |
| AIOKafka for async consumers | Calling flush after every message destroys batching. |
| delivery reports and callbacks | Calling flush after every message destroys batching. |
Failure-recovery drill: confluent-kafka & kafka-python
- Foundation: implement or demonstrate Producer/Consumer/AdminClient with one valid input and one invalid input. Record the exact output or failure.
- Integration: combine Producer/Consumer/AdminClient with AIOKafka for async consumers. Explain which component owns validation and cleanup.
- Production: design a test or experiment that exposes the failure described for delivery reports and callbacks. State the metric, assertion, or query plan that proves the correction.
What a strong checkpoint answer contains
- A precise boundary and typed or validated input.
- One named guarantee, not only a library call.
- A negative case that fails for the intended reason.
- Cleanup, transaction, retry, or cancellation behavior where applicable.
- Evidence: assertion, command output, plan, trace, metric, or accessible UI state.
2. Error handling & DLQ
The Error handling & DLQ unit begins with retry topic pattern (topic→retry→dlt): Retry topics delay reprocessing without blocking the main partition; a dead-letter topic stores messages that exhausted policy. Alert, inspect, and provide a controlled replay tool. The rest of this section connects that guarantee to this unit's related roadmap concepts instead of treating each term as an isolated flashcard.
Guarantees before APIs: Error handling & DLQ
| Concept | Meaning | Engineering decision |
|---|---|---|
| retry topic pattern (topic→retry→dlt) | Retry topics delay reprocessing without blocking the main partition; a dead-letter topic stores messages that exhausted policy. | Alert, inspect, and provide a controlled replay tool. |
| Dead Letter Topic with error envelope | Queue routing isolates workloads by latency, resource profile, or priority; dead-letter handling preserves terminal failures for diagnosis. | Use separate workers for hard isolation and record an error envelope with original identity. |
| DLT alerting strategy | Retry topics delay reprocessing without blocking the main partition; a dead-letter topic stores messages that exhausted policy. | Alert, inspect, and provide a controlled replay tool. |
Message and failure lifecycle: Error handling & DLQ
retry topic pattern (topic→retry→dlt). Consumers publish an envelope containing original topic/partition/offset, event identity, attempt count, and sanitized error, then commit according to the handoff design.
Dead Letter Topic with error envelope. The broker's priority semantics and worker prefetch determine whether priority is actually observed.
DLT alerting strategy. Consumers publish an envelope containing original topic/partition/offset, event identity, attempt count, and sanitized error, then commit according to the handoff design.
Read these as one system: retry topic pattern (topic→retry→dlt) establishes the starting contract, Dead Letter Topic with error envelope changes how that contract is executed or represented, and DLT alerting strategy exposes a later boundary or failure condition. A local optimization is useful only when the combined behavior stays correct and observable.
A recoverable implementation slice: Error handling & DLQ
1event = {"event_id": event_id, "type": "retry_topic_pattern_topic_retry_dlt.v1", "payload": payload}2producer.produce(topic, key=entity_id, value=encode(event), on_delivery=delivered)3producer.poll(0)This Error handling & DLQ slice makes retry topic pattern (topic→retry→dlt) observable. Read it from the boundary inward: identify the input, the validation point, the state or operation, and the value that proves the result. Before extending it toward DLT alerting strategy, predict its behavior for empty, invalid, repeated, and large input.
Duplicate, ordering, and outage traps: Error handling & DLQ
| Risk | Why it matters |
|---|---|
| retry topic pattern (topic→retry→dlt) | A DLT without ownership, retention, and replay policy is only a data graveyard. |
| Dead Letter Topic with error envelope | Priority cannot preempt work already reserved or executing. |
| DLT alerting strategy | A DLT without ownership, retention, and replay policy is only a data graveyard. |
Failure-recovery drill: Error handling & DLQ
- Foundation: implement or demonstrate retry topic pattern (topic→retry→dlt) with one valid input and one invalid input. Record the exact output or failure.
- Integration: combine retry topic pattern (topic→retry→dlt) with Dead Letter Topic with error envelope. Explain which component owns validation and cleanup.
- Production: design a test or experiment that exposes the failure described for DLT alerting strategy. State the metric, assertion, or query plan that proves the correction.
What a strong checkpoint answer contains
- A precise boundary and typed or validated input.
- One named guarantee, not only a library call.
- A negative case that fails for the intended reason.
- Cleanup, transaction, retry, or cancellation behavior where applicable.
- Evidence: assertion, command output, plan, trace, metric, or accessible UI state.
3. Schema Registry & Avro
The Schema Registry & Avro unit begins with Avro schema definition: Schema Registry gives events a versioned contract; Avro encodes data compactly against that schema. Add optional fields with defaults and test producer-consumer compatibility in CI. The rest of this section connects that guarantee to this unit's related roadmap concepts instead of treating each term as an isolated flashcard.
Guarantees before APIs: Schema Registry & Avro
| Concept | Meaning | Engineering decision |
|---|---|---|
| Avro schema definition | Schema Registry gives events a versioned contract; Avro encodes data compactly against that schema. | Add optional fields with defaults and test producer-consumer compatibility in CI. |
| compatibility modes: BACKWARD/FORWARD/FULL | Schema Registry gives events a versioned contract; Avro encodes data compactly against that schema. | Add optional fields with defaults and test producer-consumer compatibility in CI. |
| confluent-kafka + fastavro integration | Python clients expose Kafka's producer accumulator, consumer poll loop, and administrative APIs with different performance and async trade-offs. | Treat callback errors as delivery outcomes and close consumers gracefully. |
| schema evolution: adding optional fields | Schema Registry gives events a versioned contract; Avro encodes data compactly against that schema. | Add optional fields with defaults and test producer-consumer compatibility in CI. |
Message and failure lifecycle: Schema Registry & Avro
Avro schema definition. A wire header identifies the registered schema; readers resolve writer and reader schemas under compatibility rules.
compatibility modes: BACKWARD/FORWARD/FULL. A wire header identifies the registered schema; readers resolve writer and reader schemas under compatibility rules.
confluent-kafka + fastavro integration. confluent-kafka delegates protocol work to librdkafka background threads; callbacks are served when the application polls or flushes.
schema evolution: adding optional fields. A wire header identifies the registered schema; readers resolve writer and reader schemas under compatibility rules.
Read these as one system: Avro schema definition establishes the starting contract, compatibility modes: BACKWARD/FORWARD/FULL changes how that contract is executed or represented, and schema evolution: adding optional fields exposes a later boundary or failure condition. A local optimization is useful only when the combined behavior stays correct and observable.
A recoverable implementation slice: Schema Registry & Avro
1type Query { recipe(id: ID!): Recipe }2type Recipe { id: ID!, title: String!, reviews(first: Int!): ReviewConnection! }This Schema Registry & Avro slice makes Avro schema definition observable. Read it from the boundary inward: identify the input, the validation point, the state or operation, and the value that proves the result. Before extending it toward schema evolution: adding optional fields, predict its behavior for empty, invalid, repeated, and large input.
Duplicate, ordering, and outage traps: Schema Registry & Avro
| Risk | Why it matters |
|---|---|
| Avro schema definition | Changing meaning without changing a field name is still a breaking semantic change. |
| compatibility modes: BACKWARD/FORWARD/FULL | Changing meaning without changing a field name is still a breaking semantic change. |
| confluent-kafka + fastavro integration | Calling flush after every message destroys batching. |
| schema evolution: adding optional fields | Changing meaning without changing a field name is still a breaking semantic change. |
Failure-recovery drill: Schema Registry & Avro
- Foundation: implement or demonstrate Avro schema definition with one valid input and one invalid input. Record the exact output or failure.
- Integration: combine Avro schema definition with compatibility modes: BACKWARD/FORWARD/FULL. Explain which component owns validation and cleanup.
- Production: design a test or experiment that exposes the failure described for schema evolution: adding optional fields. State the metric, assertion, or query plan that proves the correction.
What a strong checkpoint answer contains
- A precise boundary and typed or validated input.
- One named guarantee, not only a library call.
- A negative case that fails for the intended reason.
- Cleanup, transaction, retry, or cancellation behavior where applicable.
- Evidence: assertion, command output, plan, trace, metric, or accessible UI state.
4. Producer & consumer modes
The Producer & consumer modes unit begins with synchronous flush vs asynchronous delivery: Kafka client mode choices define serialization, delivery callbacks, partition assignment, commit ownership, transactional identity, and asynchronous polling behavior. Use versioned schemas, stable keys, bounded polling loops, explicit shutdown, and idempotent side effects before advancing recoverable progress. The rest of this section connects that guarantee to this unit's related roadmap concepts instead of treating each term as an isolated flashcard.
Guarantees before APIs: Producer & consumer modes
| Concept | Meaning | Engineering decision |
|---|---|---|
| synchronous flush vs asynchronous delivery | Kafka client mode choices define serialization, delivery callbacks, partition assignment, commit ownership, transactional identity, and asynchronous polling behavior. | Use versioned schemas, stable keys, bounded polling loops, explicit shutdown, and idempotent side effects before advancing recoverable progress. |
| JSON serializer vs Avro serializer | Kafka client mode choices define serialization, delivery callbacks, partition assignment, commit ownership, transactional identity, and asynchronous polling behavior. | Use versioned schemas, stable keys, bounded polling loops, explicit shutdown, and idempotent side effects before advancing recoverable progress. |
| transactional producer lifecycle | Kafka client mode choices define serialization, delivery callbacks, partition assignment, commit ownership, transactional identity, and asynchronous polling behavior. | Use versioned schemas, stable keys, bounded polling loops, explicit shutdown, and idempotent side effects before advancing recoverable progress. |
| auto.offset.reset earliest/latest/error | Kafka client mode choices define serialization, delivery callbacks, partition assignment, commit ownership, transactional identity, and asynchronous polling behavior. | Use versioned schemas, stable keys, bounded polling loops, explicit shutdown, and idempotent side effects before advancing recoverable progress. |
| sync vs async commit callbacks | Kafka client mode choices define serialization, delivery callbacks, partition assignment, commit ownership, transactional identity, and asynchronous polling behavior. | Use versioned schemas, stable keys, bounded polling loops, explicit shutdown, and idempotent side effects before advancing recoverable progress. |
| subscribe assignment vs manual assign | Kafka client mode choices define serialization, delivery callbacks, partition assignment, commit ownership, transactional identity, and asynchronous polling behavior. | Use versioned schemas, stable keys, bounded polling loops, explicit shutdown, and idempotent side effects before advancing recoverable progress. |
Message and failure lifecycle: Producer & consumer modes
synchronous flush vs asynchronous delivery. Producers batch and deliver in the background while application polling serves callbacks; consumers either subscribe for group-managed assignment or explicitly assign partitions and then commit only according to the chosen processing guarantee.
JSON serializer vs Avro serializer. Producers batch and deliver in the background while application polling serves callbacks; consumers either subscribe for group-managed assignment or explicitly assign partitions and then commit only according to the chosen processing guarantee.
transactional producer lifecycle. Producers batch and deliver in the background while application polling serves callbacks; consumers either subscribe for group-managed assignment or explicitly assign partitions and then commit only according to the chosen processing guarantee.
auto.offset.reset earliest/latest/error. Producers batch and deliver in the background while application polling serves callbacks; consumers either subscribe for group-managed assignment or explicitly assign partitions and then commit only according to the chosen processing guarantee.
sync vs async commit callbacks. Producers batch and deliver in the background while application polling serves callbacks; consumers either subscribe for group-managed assignment or explicitly assign partitions and then commit only according to the chosen processing guarantee.
subscribe assignment vs manual assign. Producers batch and deliver in the background while application polling serves callbacks; consumers either subscribe for group-managed assignment or explicitly assign partitions and then commit only according to the chosen processing guarantee.
Read these as one system: synchronous flush vs asynchronous delivery establishes the starting contract, JSON serializer vs Avro serializer changes how that contract is executed or represented, and subscribe assignment vs manual assign exposes a later boundary or failure condition. A local optimization is useful only when the combined behavior stays correct and observable.
A recoverable implementation slice: Producer & consumer modes
1event = {"event_id": event_id, "type": "synchronous_flush_vs_asynchronous_delivery.v1", "payload": payload}2producer.produce(topic, key=entity_id, value=encode(event), on_delivery=delivered)3producer.poll(0)This Producer & consumer modes slice makes synchronous flush vs asynchronous delivery observable. Read it from the boundary inward: identify the input, the validation point, the state or operation, and the value that proves the result. Before extending it toward subscribe assignment vs manual assign, predict its behavior for empty, invalid, repeated, and large input.
Duplicate, ordering, and outage traps: Producer & consumer modes
| Risk | Why it matters |
|---|---|
| synchronous flush vs asynchronous delivery | A JSON serializer is not a DRF serializer, and manual assignment does not participate in consumer-group rebalancing. |
| JSON serializer vs Avro serializer | A JSON serializer is not a DRF serializer, and manual assignment does not participate in consumer-group rebalancing. |
| transactional producer lifecycle | A JSON serializer is not a DRF serializer, and manual assignment does not participate in consumer-group rebalancing. |
| auto.offset.reset earliest/latest/error | A JSON serializer is not a DRF serializer, and manual assignment does not participate in consumer-group rebalancing. |
| sync vs async commit callbacks | A JSON serializer is not a DRF serializer, and manual assignment does not participate in consumer-group rebalancing. |
| subscribe assignment vs manual assign | A JSON serializer is not a DRF serializer, and manual assignment does not participate in consumer-group rebalancing. |
Failure-recovery drill: Producer & consumer modes
- Foundation: implement or demonstrate synchronous flush vs asynchronous delivery with one valid input and one invalid input. Record the exact output or failure.
- Integration: combine synchronous flush vs asynchronous delivery with JSON serializer vs Avro serializer. Explain which component owns validation and cleanup.
- Production: design a test or experiment that exposes the failure described for subscribe assignment vs manual assign. State the metric, assertion, or query plan that proves the correction.
What a strong checkpoint answer contains
- A precise boundary and typed or validated input.
- One named guarantee, not only a library call.
- A negative case that fails for the intended reason.
- Cleanup, transaction, retry, or cancellation behavior where applicable.
- Evidence: assertion, command output, plan, trace, metric, or accessible UI state.
Complete worked example
This example integrates the chapter rather than demonstrating an isolated method.
1def consume(consumer, repository, producer):2 while True:3 message = consumer.poll(1.0)4 if message is None:5 continue6 if message.error():7 raise KafkaException(message.error())8 event = deserialize_avro(message.value())9 try:10 repository.apply_once(event["event_id"], event)11 except PermanentDomainError as exc:12 producer.produce("orders.dlt.v1", key=message.key(), value=error_envelope(message, exc))13 consumer.commit(message=message, asynchronous=False)Expected result
1The handler applies each event identity once, routes permanent failures to a DLT, then commits the processed offset.Line-by-line reading
| Line | Code | Explanation |
|---|---|---|
| 1 | def consume(consumer, repository, producer): | Defines a function; its parameters form the explicit input boundary. |
| 2 | while True: | Repeats while the condition remains true; the body must make progress toward termination. |
| 3 | message = consumer.poll(1.0) | Computes or receives a value and binds it for the next step; the referenced object remains separate from the name. |
| 4 | if message is None: | Evaluates the condition and enters this branch only when it is truthy. |
| 5 | continue | Implements the next python statement in the example's data flow. |
| 6 | if message.error(): | Evaluates the condition and enters this branch only when it is truthy. |
| 7 | raise KafkaException(message.error()) | Stops the happy path with a deliberate exception carrying the boundary failure. |
| 8 | event = deserialize_avro(message.value()) | Computes or receives a value and binds it for the next step; the referenced object remains separate from the name. |
| 9 | try: | Defines failure translation or cleanup that must run around the protected operation. |
| 10 | repository.apply_once(event["event_id"], event) | Implements the next python statement in the example's data flow. |
| 11 | except PermanentDomainError as exc: | Defines failure translation or cleanup that must run around the protected operation. |
| 12 | producer.produce("orders.dlt.v1", key=message.key(), value=error_envelope(message, exc)) | Computes or receives a value and binds it for the next step; the referenced object remains separate from the name. |
| 13 | consumer.commit(message=message, asynchronous=False) | Computes or receives a value and binds it for the next step; the referenced object remains separate from the name. |
Step-by-step execution
- The producer validates and serializes a versioned record, hashes its key to a partition, batches it, and sends it to that partition's leader under the configured acknowledgment policy.
- The broker appends the record at the next partition offset and replicates it; durability depends on acknowledgments, in-sync replicas, and minimum-ISR settings together.
- A group member polls assigned partitions, deserializes the record, checks event identity, and performs its bounded idempotent side effect.
- Recoverable progress advances only after the corresponding effect is durable, or a Kafka transaction atomically publishes output and offsets for Kafka-to-Kafka work.
- Tests inject duplicate delivery, rebalance, poison data, broker interruption, and lag while asserting ordering only within the declared key scope.
Common mistakes and professional corrections
| Area | Common failure | Better engineering choice |
|---|---|---|
| confluent-kafka & kafka-python | Calling flush after every message destroys batching. | Treat callback errors as delivery outcomes and close consumers gracefully. |
| Error handling & DLQ | A DLT without ownership, retention, and replay policy is only a data graveyard. | Alert, inspect, and provide a controlled replay tool. |
| Schema Registry & Avro | Changing meaning without changing a field name is still a breaking semantic change. | Add optional fields with defaults and test producer-consumer compatibility in CI. |
| Producer & consumer modes | A JSON serializer is not a DRF serializer, and manual assignment does not participate in consumer-group rebalancing. | Use versioned schemas, stable keys, bounded polling loops, explicit shutdown, and idempotent side effects before advancing recoverable progress. |
Interview and review notes
- Define the central abstraction without naming a library function.
- Trace one request, call, query, message, render, or state transition from input to observable result.
- Compare two alternatives from this chapter by guarantee, cost, and failure behavior.
- Explain the most likely production bug and the test or metric that reveals it.
- State what remains authoritative after process loss, retry, reconnect, or deployment.
Practice set
Easy
- Define every bold term in the concept tables in one precise sentence.
- Reproduce the focused examples and annotate the value or state after each important line.
- Explain the chapter progression diagram aloud in two minutes.
Medium
- Replace one convenient default with an explicit policy for validation, timeout, ordering, pagination, cleanup, or error handling.
- Write a negative test for each topic group.
- Compare the measured behavior before and after one justified change.
Hard
- Combine all topic groups into one thin vertical slice.
- Inject a realistic failure at the most important external boundary and prove recovery.
- Write a one-page design note covering ownership, trade-offs, security, observability, and rollback.
Chapter submission
Submit:
- source code or reproducible commands;
- automated tests plus one deliberately failing-before-fix test;
- captured output, query plan, trace, screenshot, or metric;
- a 300–500 word explanation of the execution flow and one rejected alternative;
- a short README with setup, versions, limitations, and cleanup steps.
- Continue with the Order System + Schema Registry project workshop.
Self-review rubric
| Dimension | Beginning | Competent | Professional |
|---|---|---|---|
| Explanation | Names APIs | Explains behavior | Connects guarantees, internals, and trade-offs |
| Implementation | Happy path only | Validated and tested | Clear ownership, failure recovery, and cleanup |
| Evidence | Manual claim | Repeatable output | Tests plus meaningful measurement or inspection |
| Communication | Steps missing | Reproducible README | Decisions, limits, and alternatives are explicit |
Roadmap coverage checklist
- To do: confluent-kafka & kafka-python: Producer/Consumer/AdminClient
- To do: confluent-kafka & kafka-python: AIOKafka for async consumers
- To do: confluent-kafka & kafka-python: delivery reports and callbacks
- To do: Error handling & DLQ: retry topic pattern (topic→retry→dlt)
- To do: Error handling & DLQ: Dead Letter Topic with error envelope
- To do: Error handling & DLQ: DLT alerting strategy
- To do: Schema Registry & Avro: Avro schema definition
- To do: Schema Registry & Avro: compatibility modes: BACKWARD/FORWARD/FULL
- To do: Schema Registry & Avro: confluent-kafka + fastavro integration
- To do: Schema Registry & Avro: schema evolution: adding optional fields
- To do: Producer & consumer modes: synchronous flush vs asynchronous delivery
- To do: Producer & consumer modes: JSON serializer vs Avro serializer
- To do: Producer & consumer modes: transactional producer lifecycle
- To do: Producer & consumer modes: auto.offset.reset earliest/latest/error
- To do: Producer & consumer modes: sync vs async commit callbacks
- To do: Producer & consumer modes: subscribe assignment vs manual assign
Quick revision
- confluent-kafka & kafka-python: connect the surface API to its guarantee, lifecycle, failure boundary, and evidence.
- Error handling & DLQ: connect the surface API to its guarantee, lifecycle, failure boundary, and evidence.
- Schema Registry & Avro: connect the surface API to its guarantee, lifecycle, failure boundary, and evidence.
- Producer & consumer modes: connect the surface API to its guarantee, lifecycle, failure boundary, and evidence.
- Re-read the worked-example execution trace instead of memorizing isolated syntax.
- If you cannot name the owner of state and cleanup, the design is not yet complete.
Mastery check
How well can you recall this?
Finished this lesson?