kafka_group library
Experimental classic-group sessions, delivery and bounded serial consumption.
KafkaGroupSession joins one dynamic classic-group generation, maintains heartbeats and revokes locally on loss. Its delivery and processing handles expose assigned records, explicit acknowledgements and generation commits; the session does not automatically rejoin or commit.
KafkaGroupConsumer adds an owned serial processing callback, an explicit choice of commit-after-processing behavior and a finite rejoin policy. Replacement is limited to eligible stable-heartbeat failures after successful callback, commit and owned cleanup drains. Other failures remain terminal. It reads fresh committed positions for each generation; missing positions require explicit numeric fallbacks or the separate opt-in boundary lookup. It does not silently reset offsets or provide general transparent recovery.
Assignment guards do not fence broker operations or asynchronous application effects. Neither API provides exactly-once application processing.
Classes
- Broker
- Kafka TCP endpoint used for bootstrap or partition-leader routing.
- BrokerMetadata
- Represents metadata information about a Kafka broker.
- FetchPartitionResponse
- Records and log positions returned for a single partition.
- FetchResponse
- Decoded experimental Fetch v4 response with read-uncommitted records.
- FetchTopicResponse
- Fetch results for one topic.
- KafkaCancellationToken
- Cooperatively cancel a low-level send. Cancellation never logs a reason or credentials, and does not promise that an already sent Produce was undone.
- KafkaClient
- Experimental native Kafka client with validated TLS and optional PLAIN SASL. TLS is never downgraded and SASL credentials are never sent without TLS.
- KafkaCommittedOffset
- A broker-stored next position for an explicitly managed partition.
- KafkaGroupAssignment
- An immutable, controller-issued identity token, not a broker fencing lease. An empty snapshot owns no partitions. Checking this token establishes local validity only at that instant, never the safety of later asynchronous effects.
- KafkaGroupCommitResult
- Immutable evidence for one topic's explicit commit snapshot. Empty partitions means no request was necessary. A confirmed response can arrive after local revocation; that evidence never restores authority or fences outside effects.
- KafkaGroupConsumer
- Opt-in serial processing with fresh committed positions and bounded rejoin.
- KafkaGroupConsumerDrainResult
- Snapshot when an opt-in grace attempt ends. KafkaGroupConsumerDrainOutcome.drained means only the owned application Future and configured per-record commit settled successfully before its deadline, or no application work was pending. Cleanup may still fail or time out; inspect KafkaGroupConsumer.closed.
- KafkaGroupConsumerTermination
- Final evidence after the callback/data/commit/position barriers and the bounded membership cleanup attempt settle. A membership cleanup timeout can leave underlying shutdown unconfirmed; inspect every cleanup result. Socket closure cannot prove broker departure or undo effects. No hard overall deadline.
- KafkaGroupDelivery
- A single-listener, single-generation delivery handle.
- KafkaGroupDeliveryTermination
- Result of stopping record admission and settling owned data-client work. The membership cleanup result remains available separately on the session.
- KafkaGroupPartitionCommit
- KafkaGroupProcessing
- Opt-in, bounded processing for one session generation. Only acknowledgement of actually delivered objects advances processing candidates. Commits remain explicit, one topic and one immutable snapshot at a time; none are replayed.
- KafkaGroupRecord
- One read-uncommitted record admitted under this exact local assignment.
- KafkaGroupSession
- Experimental, single-generation classic-group membership management.
- KafkaGroupStableHeartbeatFailure
- Controller-issued evidence that an established session's scheduled heartbeat failed. This is never issued for the initial heartbeat, local expiry, or application/processing failures. It does not itself classify retry safety.
- KafkaGroupTermination
- Revocation resolves with the original cause before cleanup. The closed future on the controller resolves with a new snapshot including best-effort departure. Transport closure alone never proves broker-side membership was removed.
- KafkaRecord
- A binary record. Null values are tombstones, distinct from empty values.
- KafkaRecordHeader
- A record header. Duplicate keys and null values are preserved.
- KafkaSaslPlain
- SASL/PLAIN credentials, to be sent only over server-authenticated TLS.
- KafkaStableOffsetRetry
- Opt-in retry of unstable (error 88) committed offsets, requiring stable v7.
- KafkaTlsClientIdentity
- An optional client certificate identity for native mutual TLS (mTLS).
- KafkaTlsConfig
- Server-authenticated TLS settings with optional client authentication.
- KafkaTlsFetchRecovery
- Opt-in, bounded recovery from TLS-rejected or stale Fetch leaders.
- KafkaTopicRecord
- One read-uncommitted record from an explicitly selected topic partition.
- ListOffsetsPartitionResponse
- Broker result for a single partition, without interpreting errorCode.
- ListOffsetsResponse
- Immutable ListOffsets v2 results, including raw per-partition Kafka errors.
- ListOffsetsTopicResponse
- Results for one topic; the partition list is copied and immutable.
- MetadataResponse
- Represents a response to a MetadataRequest from Kafka.
- PartitionMetadata
- Represents metadata information about a partition within a Kafka topic.
- PartitionResponse
- Represents the response for a specific partition in a produce request.
- ProduceResponse
- Decoded experimental Produce v3 response for acknowledged writes.
- Record
- Backward-compatible record name; payloads are bytes, not implicit JSON.
- TopicMetadata
- Represents metadata information about a Kafka topic.
- TopicResponse
- Represents the response for a specific topic in a produce request.
Enums
- KafkaGroupCommitOutcome
- Evidence for one explicitly attempted partition commit. Unknown is not rejection or rollback, and never authorizes automatic replay.
- KafkaGroupConsumerDrainOutcome
- The grace attempt's result, separate from actual KafkaGroupConsumer.closed.
- KafkaGroupConsumerState
- This runner owns one serial application Future at a time. Draining means that exact returned Future settled, not that detached work or outside effects were cancelled or fenced. A callback must return all work belonging to its record.
- KafkaGroupConsumerStopReason
- KafkaGroupDeliveryStopReason
- KafkaGroupLeaveOutcome
- Broker departure evidence. Even notAttempted can leave a broker member alive until broker expiry, including an unidentified member after a lost Join.
- KafkaGroupSessionState
- Local controller state. Closed means a bounded cleanup attempt finished, not proof that transport closure or broker departure was confirmed.
- KafkaGroupStopReason
- KafkaOffsetPosition
- Explicit broker position to look up without changing a consumer's position.
Exceptions / Errors
- KafkaAuthenticationException
- A sanitized authentication failure that never retains broker error text.
- KafkaBrokerException
- A broker reported a nonzero Kafka error code.
- KafkaCancelledException
- A canceled local wait. Cancellation cannot undo bytes already sent to Kafka.
- KafkaConnectionException
- A connection ended before a request could complete. Produce delivery may be ambiguous; this exception never authorizes automatic produce replay.
- KafkaGroupProcessingCleanupException
- Both cleanup paths were still attempted. A cancellation-hook failure does not establish cancellation or transport shutdown, even if the request settles.
- KafkaOffsetCommitException
- A complete OffsetCommit response reported one or more partition errors.
- KafkaResourceLimitException
- A configured wire-resource budget was exceeded.