Skip to main content

Question 36 of 50

Does Kafka have native DLQ?

SeniorTech Lead

Question

"Does Kafka have a native DLQ mechanism, like SQS does?"

What the interviewer wants to assess

This is a frequent, revealing trap question — it tests whether the candidate assumes, by analogy with SQS, that Kafka has DLQ "out of the box."

Resposta rápida

No. Unlike SQS, which has DLQ natively built into the queue, Kafka has no native dead-lettering feature at all. A "DLQ" in Kafka is, in practice, just an ordinary topic — the logic to publish problematic messages to it is the application's or a framework's responsibility.

Resposta nível Sênior

SQS has a native configuration attribute (RedrivePolicy) that AWS manages internally. Kafka has no equivalent — the "DLQ topic" is an architectural convention, not a platform feature: you create a normal topic (for example, <topic>.DLT) and implement the logic to publish to it once retry attempts are exhausted. Spring Kafka makes this easier with DeadLetterPublishingRecoverer, which integrates with DefaultErrorHandler and automatically publishes to the configured DLQ topic — but that's a framework abstraction on top of Kafka, not a native broker capability.

In-depth explanation

See "DLQ in Kafka: it's not native" in Chapter 9 and the practical implementation in Chapter 14.

Exemplo financeiro

A team migrating from SQS to Kafka needs to explicitly implement the DLQ logic (via DeadLetterPublishingRecoverer or equivalent) — there's no Kafka topic configuration parameter that enables this automatically, unlike SQS.

"Sure, any Kafka topic can have a DLQ configured on itself"

There's no topic configuration that enables DLQ automatically. The DLQ is always a separate topic, created and populated by explicit application or framework logic — never an attribute of the original topic.

Pode vir a seguir

Likely follow-ups: "how would you implement a DLQ in Kafka?" and "what is a Poison Pill?".

Related chapters