Scrivio Interview library
ConceptIntermediate6 min read · updated 12 November 2026

Kafka is adding share groups (KIP-932), often described as "queues for Kafka". Explain how a share group differs from a consumer group in partition assignment, acknowledgement, redelivery and ordering, and what problem it solves.

Try it yourself

Consumer group: who reads which partition

Change the number of partitions and consumers, and see who owns what, who is idle, and where ordering holds.

Read this example as text

Who reads which partition

  1. 3 partitions, 2 consumers. C0 reads P0, P1; C1 reads P2.
  2. 4 partitions, 2 consumers. C0 reads P0, P1; C1 reads P2, P3.
  3. 3 partitions, 3 consumers. C0 reads P0; C1 reads P1; C2 reads P2.
  4. 6 partitions, 4 consumers. C0 reads P0, P1; C1 reads P2, P3; C2 reads P4; C3 reads P5.
  5. 2 partitions, 4 consumers. C0 reads P0; C1 reads P1; C2 is idle; C3 is idle.

A partition has exactly one reader in the group. A consumer beyond the number of partitions is idle.

Six records with 3 partitions and 2 consumers

  1. Record A1. Key A goes to P0, read by C0.
  2. Record B1. Key B goes to P1, read by C0.
  3. Record A2. Key A goes to P0, read by C0.
  4. Record C1. Key C goes to P2, read by C1.
  5. Record B2. Key B goes to P1, read by C0.
  6. Record A3. Key A goes to P0, read by C0.

A1, A2 and A3 sit in one partition and are read in that order. Nothing orders a record in one partition against a record in another.

What this example leaves out
  • One topic, and Kafka's range assignor, the first in the default list. Other assignors spread partitions differently.
  • A, B and C stand for key hashes 0, 1 and 2. The real client hashes the key bytes; the rule shown, same key to the same partition, is the same.
  • A rebalance is shown as instant. In a real group, consumers stop briefly while partitions move.

A share group lets many consumers read the same partition at once, so parallelism is no longer capped by the partition count. Instead of committing an offset, each consumer acknowledges records one by one as accepted, released or rejected; records that are not acknowledged in time are redelivered after a lock timeout, and the broker counts deliveries and gives up after a limit. The price is ordering: there is no per-partition processing order, so share groups suit independent work items rather than ordered event streams. They arrived as early access in Kafka 4.0 and preview in 4.1, so check your versions before production use.

Why this question is asked

For years, teams that wanted queue behaviour on Kafka had to bend consumer groups to it: adding partitions just to get more consumers, or building their own retry and per-message acknowledgement logic. KIP-932, the Kafka improvement proposal that defines share groups, adds that behaviour to the broker itself, and interviewers ask about it because it changes when Kafka is a reasonable choice for job queues. In this answer, we will recap how a consumer group works, then compare share groups on assignment, acknowledgement, redelivery and ordering, see the delivery states a record goes through, and finish with what problem this solves and how mature it is.

1A Quick Recap of Consumer Groups

In a classic consumer group, the broker assigns each partition to exactly one consumer in the group. That consumer reads the partition in order and commits an offset, a single number that says everything before this point is done. The model is simple and very efficient, and it is what gives Kafka per-key ordering.

But it has two consequences for job processing. A group can never use more consumers than there are partitions, so a topic with 6 partitions has at most 6 workers, however slow each job is. And an offset cannot say record 10 failed but record 11 succeeded; one slow or failing record holds up everything behind it in that partition.

2How a Share Group Assigns and Acknowledges

A share group is a different kind of group with the same topics. Consumers in a share group are not given exclusive partitions. Several consumers can fetch from the same partition at the same time, and the broker hands each of them different records. So 6 partitions can feed 30 consumers.

To make that safe, the broker keeps track of each record that is in flight. When it delivers a record to a consumer, it acquires a lock on it for that consumer for a limited time, 30 seconds by default (group.share.record.lock.duration.ms; check your version). The consumer then acknowledges each record individually: ACCEPT means processed, RELEASE means give it back so it can be delivered again, perhaps to another consumer, and REJECT means it cannot be processed and should not be redelivered.

Java
// Kafka client API for share groups (shape may change while the feature matures)
// props: group.id=image-jobs, explicit acknowledgement mode on (check the config name for your version)
try (KafkaShareConsumer<String, String> consumer = new KafkaShareConsumer<>(props)) {
consumer.subscribe(List.of("image-jobs"));
while (running) {
for (ConsumerRecord<String, String> rec : consumer.poll(Duration.ofMillis(500))) {
try {
resize(rec.value());
consumer.acknowledge(rec, AcknowledgeType.ACCEPT); // done
} catch (TransientException e) {
consumer.acknowledge(rec, AcknowledgeType.RELEASE); // try again later
} catch (BadImageException e) {
consumer.acknowledge(rec, AcknowledgeType.REJECT); // give up on this one
}
}
consumer.commitSync(); // send the acknowledgements
}
}

Notice that there is no offset to commit. The broker tracks, per partition, a window of in-flight records and moves its start forward as records at the front are accepted or rejected. Spring Kafka adds share consumer support in its 4.x line; check your version for the container and factory names.

3Redelivery and the Delivery Count

If a consumer crashes, or simply takes longer than the lock duration, the lock expires and the record becomes available again. This is the queue behaviour we know from RabbitMQ or SQS visibility timeouts, and it means processing is at least once: the same job can run twice, so handlers must be idempotent.

The broker also counts how many times each record has been delivered. When the count reaches a limit, 5 by default (group.share.delivery.count.limit), the broker stops redelivering it and archives it as rejected. That protects the group from a poison record that crashes every consumer that touches it. It plays the role of dead-lettering, although at first the broker just stops delivering rather than moving the record to a separate topic, so if we want to keep failed jobs for inspection we write them somewhere ourselves before rejecting.

Step throughLife of a record in a share group
  1. Availablerecord can be fetched
  2. Acquired by a consumerlock for 30 s, delivery count + 1
  3. Acknowledged in time?
    YesLook at the acknowledgementNoLock expires: back to Available
  4. ACCEPT or REJECT?
    YesDone: archivedNoRELEASE: back to Available
  5. Delivery count at limit?
    YesArchived as rejectedNoDelivered again

5 steps in order. Play them, or step through them one at a time.

4What Happens to Ordering

Because several consumers take records from one partition and some records are released and redelivered later, the order in which records are processed is no longer the order in the log. Record 11 can be accepted before record 10, and record 10 might be processed by a different consumer a minute later. There is no per-partition or per-key ordering guarantee for processing.

So share groups fit independent work items: resizing images, sending emails, running reports, calling a partner API for each item. They do not fit event streams where order matters, such as account balance updates or a customer's order lifecycle. Those stay on consumer groups. The two kinds of group can read the same topic side by side, which is a nice property: one topic can feed an ordered consumer group for analytics and a share group of workers.

Consumer group and share group
Consumer groupShare group
Partition assignmentone consumer per partitionmany consumers per partition
Max useful consumerspartition countnot tied to partitions
Progresscommit one offsetacknowledge each record
Failure of one recordblocks the partitionrelease or reject just that record
Redeliveryrewind the offsetlock timeout, delivery count limit
Orderingper partition, per keynone for processing

5The Problem It Solves, and Its Status

Share groups solve the classic mismatch between Kafka and job queues: work that needs elastic numbers of workers and per-item acknowledgement, without over-partitioning topics or running a second messaging system just for queues. They keep Kafka's strengths, retention, replay and the same security and tooling, while adding queue semantics.

The feature is still young. It was early access in Kafka 4.0 and preview in 4.1, and production readiness, client support in other languages and Spring Kafka integration have been arriving over recent releases. Before relying on it, we check the exact Kafka, client and Spring Kafka versions, and whether our managed Kafka provider enables it.

6Follow-up questions

How would you size consumers for a share group?

From throughput and processing time rather than partitions. If jobs arrive at 200 per second at peak and each takes on average 0.5 seconds of one thread, we need about 100 busy threads, plus headroom of perhaps 30 percent, so around 130 threads spread over instances. The partition count still matters a little, because each partition's in-flight window is limited and fetches are per partition, so very few partitions with very many consumers can become a bottleneck, and brokers limit the members of a share group (check your version for the setting). I would also set the lock duration comfortably above the slowest normal job, so slow jobs are not redelivered while still running.

Can a share group and a consumer group read the same topic?

Yes. They are independent groups with their own progress tracking, so one topic can feed an ordered consumer group and a share group at the same time without either affecting the other.

7Conclusion

In this answer, we compared share groups with consumer groups. Share groups let many consumers read one partition, acknowledge each record as accepted, released or rejected instead of committing an offset, redeliver records whose lock times out, and stop after a delivery count limit, which acts like dead-lettering. They give up processing order, so they fit independent jobs, not ordered streams. They bring queue semantics into Kafka without over-partitioning, and since they were early access in 4.0 and preview in 4.1, we check versions before using them in production.

What to say in the interviewAbout 90 seconds aloud

Open with

In a normal consumer group, each partition is owned by one consumer and progress is a single committed offset. That gives ordering, but parallelism is capped by the partition count, and one slow or failing record holds up the partition.

Then, if they want more

A share group, from KIP-932, changes that. Many consumers in the share group can fetch from the same partition at the same time, and the broker hands each one different records and puts a time-limited lock on them, thirty seconds by default.

Instead of committing offsets, consumers acknowledge each record: accept when it is done, release to have it delivered again, or reject when it can never succeed. If the lock expires because the consumer crashed or was too slow, the record is redelivered, so processing is at least once and handlers must be idempotent.

The broker counts deliveries per record and stops after a limit, five by default, which works like dead-lettering for poison messages. The trade-off is ordering: there is no per-partition processing order, so share groups are for independent work items like jobs or notifications, not for ordered event streams.

The problem it solves is using Kafka as a job queue without over-partitioning or running a separate queue system. It was early access in Kafka 4.0 and preview in 4.1, so I would check the Kafka and client versions before production.

About this answer

Last updated
12 November 2026
Versions it names
Kafka 4.0
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.
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 "Kafka is adding share groups (KIP-932), often described as "queues for Kafka". Explain...": https://scrivio-interview-library.netlify.app/spring-boot/kafka/af96e92cac/