---
title: "Run a consumer group"
description: "Run a group of real consumers against monedula-sim-bridge, watch them split the partitions and rebalance, and resume from committed offsets."
url: https://monedula.dev/flock/docs/sim-bridge/how-to/run-a-consumer-group/
---
Real consumers form real groups: the playground runs a group coordinator for them, on the classic or the consumer protocol (KIP-848), so partitions are split by the clients' own assignor or, on the consumer protocol, by the coordinator, members rebalance when one joins or leaves, and committed offsets are there when a consumer comes back.

## Before you start

- A paired bridge, from steps 1 and 2 of [Connect your first app](/flock/docs/sim-bridge/tutorials/connect-your-first-app/).
- A topic with more than one partition, so there is something to split. [Create topics](/flock/docs/sim-bridge/how-to/create-topics/) shows how; the steps below use a topic `clicks` with 3 partitions.

## Steps

### 1. Start one consumer

Start a consumer in the group `clicks-readers`, with the console tools or the consumer from [Use the Java client](/flock/docs/sim-bridge/how-to/use-the-java-client/):

```bash
bin/kafka-console-consumer.sh --bootstrap-server 127.0.0.1:19092 \
  --topic clicks --group clicks-readers
```

After a short wait (the first rebalance of an empty group waits 3 seconds for more members, as `group.initial.rebalance.delay.ms` does on a broker), the group's lane appears on the canvas with the **app** badge, and the one member owns all three partitions.

### 2. Add a second consumer

Run the same command in another terminal. The group rebalances: both members rejoin, and the partitions are split between them. The canvas shows the new assignment.

### 3. Stop one

Stop either consumer with Ctrl-C. It leaves the group, the other member rejoins, and it owns all three partitions again.

### 4. Resume from the committed offset

Stop the last consumer, produce a few more records to `clicks`, then start a consumer in the same group again. It starts from the offsets the group committed, not from the beginning, and reads only what it missed. We tested this with a franz-go group:

```go
cl, err := kgo.NewClient(
	kgo.SeedBrokers("127.0.0.1:19092"),
	kgo.ConsumerGroup("clicks-readers"),
	kgo.ConsumeTopics("clicks"),
)
if err != nil {
	log.Fatal(err)
}
defer cl.Close()
for {
	fetches := cl.PollFetches(context.Background())
	fetches.EachRecord(func(r *kgo.Record) {
		fmt.Printf("%s/%d@%d %s\n", r.Topic, r.Partition, r.Offset, r.Value)
	})
}
```

## Things to know

- Use a group id of your own. A group id that the simulator already runs as a simulated group is refused with `INCONSISTENT_GROUP_PROTOCOL` and the message "This group belongs to the simulator; use another group id".
- Both protocols work. With `group.protocol=consumer` (KIP-848; franz-go: `kgo.ServerSideBalancer()`) the coordinator assigns the partitions with `uniform` or `range`, and `kafka-consumer-groups --describe --state` shows the group and assignment epochs. AutoMQ, Redpanda, KafScale, Nisshi and Ursa have no KIP-848 protocol: there franz-go falls back to classic and the Java client stops. A running group moves between the protocols online, as on Kafka 4.4: restart its members one at a time with `group.protocol=consumer`, and the first one converts the group to a consumer group, whose classic members keep consuming; when the last consumer-protocol member leaves, the group is classic again. A group of Kafka Connect workers, or one whose assignor keeps user data in its assignments, cannot be converted (`GROUP_ID_NOT_FOUND`).
- Static membership (`group.instance.id`) works as in Kafka 4.4 on both protocols. On the classic protocol a member that restarts with its instance id within the session timeout takes its old place and partitions without a rebalance, and the instance it replaced gets `FENCED_INSTANCE_ID` on its next request. On the consumer protocol a live instance id is refused with `UNRELEASED_INSTANCE_ID`, and a static member that leaves keeps its partitions for the session timeout, so a restart with the same id gets them back.
- Committed offsets live in the playground tab for as long as the page is open. They are never part of a share link.
- Pressing **Disconnect** removes the members; a group with committed offsets stays on the canvas without members, and one without offsets is removed.