# Consumer

- Async consumer.
- Modern Kafka consumer groups.
- No classic group protocol support.
- Topic subscription.
- Regex subscription.
- Manual assignment.
- Polling.
- Commits.
- Seek.
- Pause and resume.
- Offset lookup.
- Timestamp offset lookup.

## Group Support

- Supported: modern Kafka consumer groups.
- Supported: share groups through `KafkaShareConsumer`.
- Unsupported: classic consumer groups.
- Unsupported: classic `JoinGroup`, `SyncGroup`, and classic group heartbeat membership.
- Broker requirement: Kafka 4.0+ with the modern group protocol available.
- Migration expectation: applications using older classic-group-only brokers should upgrade brokers first.

## Modern Consumer Groups

- Membership is coordinated through the newer consumer group protocol.
- Heartbeats and assignment state are handled through the modern group APIs.
- Topic subscription and regex subscription use modern group membership.
- Manual assignment can be used when group coordination is not needed.
- Existing committed offsets remain Kafka offsets; this is a protocol compatibility choice, not a new offset store.

## Share Groups

- Share groups are separate from normal consumer groups.
- Share groups let consumers in a group share individual records instead of owning partitions exclusively.
- Records are acquired and acknowledged through the share-group APIs.
- Use share groups for work-queue style consumption.
- Use normal consumer groups for partition-ordered stream processing.

```rust
use kafkit_client::{AutoOffsetReset, KafkaClient};

# async fn example() -> kafkit_client::Result<()> {
let consumer = KafkaClient::new("localhost:9092")
    .topic("orders")
    .consumer("orders-reader")
    .with_auto_offset_reset(AutoOffsetReset::Earliest)
    .connect()
    .await?;

let records = consumer.poll().await?;
consumer.commit(&records).await?;
consumer.shutdown().await?;
# Ok(())
# }
```
