Does Kafka support priority for topic or message?
Master System Design with Codemia
Enhance your system design skills with over 120 practice problems, detailed solutions, and hands-on exercises.
Introduction
Kafka does not provide native priority queues for topics or individual messages. Its core model is an ordered append-only log per partition, so once records are written, consumers read them in offset order rather than by a priority field.
Why Native Priority Does Not Fit Kafka’s Model
Kafka is designed around sequential writes and sequential reads. That design gives it high throughput and predictable partition ordering, but it also means Kafka does not reshuffle records after they are appended.
If a message arrives later with “high priority,” Kafka does not move it ahead of earlier offsets in the same partition. Doing so would break the log semantics that many Kafka consumers depend on.
That is why there is no broker-level setting for “read urgent messages first” inside one ordinary partition stream.
Common Workaround: Separate Topics by Priority
The simplest workaround is to use separate topics such as orders-high and orders-normal.
Then consumers poll the high-priority topic more aggressively or process it first in application logic.
This does not give you one priority-aware queue, but it does give you a practical separation of urgent and non-urgent traffic.
Another Option: Put Priority in the Payload or Headers
Sometimes you do not want separate topics. In that case, you can attach a priority field and let the consumer decide what to do.
Or use a header:
This still does not change Kafka’s storage order. It only lets the consumer branch on priority after reading the record. That may be good enough if “priority” means processing policy rather than queue reordering.
Partitioning Does Not Magically Create Priority
A common mistaken idea is to map high-priority records to one partition and low-priority records to another inside the same topic. That can isolate streams somewhat, but it is still not true broker-enforced priority.
Consumers are assigned partitions according to group mechanics, not according to a built-in priority scheduler. If the application really requires urgent work to jump ahead consistently, separate topics or even separate consumer pools are usually easier to reason about than “priority by partition.”
Consumer-Side Scheduling Is Where Priority Really Lives
In Kafka systems, priority is usually an application design problem rather than a broker feature. Common patterns include:
- separate topics per priority class
- separate consumer groups with different resource budgets
- different partitions or clusters for urgent traffic
- consumer code that reads from several sources and schedules work deliberately
The right choice depends on what priority actually means in the business flow. If urgent work must never wait behind normal work, separate topics or pipelines are usually cleaner than trying to simulate priority inside one mixed stream.
Common Pitfalls
- Expecting Kafka to reorder messages inside a partition based on a priority field.
- Storing a priority attribute in the payload and assuming the broker will act on it.
- Mixing urgent and normal work in one topic when operational isolation is actually required.
- Designing “priority” at the consumer layer without considering backlog and resource contention.
- Forgetting that ordering guarantees are partition-specific, not topic-wide.
Summary
- Kafka does not natively support message or topic priority in the way a priority queue does.
- Records are consumed in partition offset order.
- Separate topics are the simplest and most common workaround.
- Payload fields or headers can carry priority metadata, but they do not reorder the log.
- In Kafka architectures, priority is usually implemented in topic design and consumer scheduling.

