# Migration Notes
These notes cover migration into the current public `kafkit-client` API and the
broker assumptions that come with it.
## Broker Migration
Before adopting this crate for consumers or transactional producers:
- Upgrade brokers to Apache Kafka 4.0 or newer.
- Verify the cluster is reachable through advertised listeners.
- Verify modern consumer groups are available.
- Verify transaction protocol v2 is available if you use transactions.
- Verify share groups are available if you use `KafkaShareConsumer`.
Older classic-group-only broker fleets should keep using an older compatible
Kafka client until the brokers are upgraded.
## API Names
Use the current public types:
- `KafkaClient` for topic-scoped application setup.
- `KafkaProducer` for direct producer control.
- `KafkaConsumer` for modern group consumption.
- `KafkaShareConsumer` for share-group consumption.
- `KafkaAdmin` for cluster and topic administration.
- `KafkaMessage` for ergonomic message production.
- `ProduceRecord` for lower-level producer records.
- `ProducerConfig`, `ConsumerConfig`, and `AdminConfig` for direct setup.
## Producer Migration
- Use `KafkaClient::new(...).topic(...).producer()` for the shortest path.
- Use `KafkaProducer::connect(ProducerConfig::new(...))` when explicit config is
needed.
- Use `KafkaMessage` when a default topic is configured.
- Use `ProduceRecord` when the topic, partition, timestamp, or tombstone state
should be explicit per record.
- Call `flush().await` when a workflow needs current buffered records completed.
- Call `shutdown().await` during service termination.
## Consumer Migration
- Use modern consumer groups only.
- Replace classic-group assumptions with topic-list, regex, or manual assignment
flows supported by `KafkaConsumer`.
- Commit processed records with `commit(&records)` or explicit offsets with
`commit_offsets(...)`.
- Use `group_metadata()` plus a transactional producer for read-process-write
workflows that need atomic offset commits.
## Security Migration
- Map TLS CA, server name, client cert, and client key settings onto
`TlsConfig` or the config convenience methods.
- Map PLAIN and SCRAM credentials onto the `with_sasl_*` helpers.
- OAuthBearer, Kerberos, and MSK IAM users need a different authentication path
until those mechanisms are implemented.