kafka_protocol library

Advanced, explicitly versioned Kafka protocol requests and responses.

Requests are single-use. KafkaClient.send does not select a partition leader or negotiate a version for caller-constructed requests. Prefer the high-level methods unless implementing protocol tooling. Classic-group requests are low-level primitives, not a managed consumer or live membership lease. Unverified legacy experiments remain unexported.

Classes

ApiVersion
ApiVersionsRequest
ApiVersionsResponse
Broker
Kafka TCP endpoint used for bootstrap or partition-leader routing.
BrokerMetadata
Represents metadata information about a Kafka broker.
ConsumerGroupAssignment
Immutable classic consumer assignment metadata, including its INT16 version.
ConsumerGroupSubscription
Immutable classic consumer subscription metadata, including its INT16 version.
FetchPartition
Fetch position and byte limit for one manually selected partition.
FetchPartitionResponse
Records and log positions returned for a single partition.
FetchRequest
Experimental Fetch v4 request for explicitly selected partitions.
FetchResponse
Decoded experimental Fetch v4 response with read-uncommitted records.
FetchTopic
A topic and the explicit partitions requested from it.
FetchTopicResponse
Fetch results for one topic.
FindCoordinatorRequest
Discovers the coordinator of a consumer group without joining it.
FindCoordinatorResponse
The non-flexible FindCoordinator v2 response.
GroupAssignment
An opaque assignment for one dynamic member.
GroupJoinProtocol
One offered consumer protocol with opaque, non-null metadata.
GroupOffsetCommitPartitionResponse
GroupOffsetCommitRequest
Manually commits next offsets without group membership or automatic commits.
GroupOffsetCommitResponse
The non-flexible OffsetCommit v6 response, with per-partition errors.
GroupOffsetCommitTopicResponse
GroupOffsetFetchPartitionResponse
GroupOffsetFetchRequest
Reads committed next offsets for explicit partitions of one topic.
GroupOffsetFetchResponse
OffsetFetch v5 or flexible v7 response, including its group-level error.
GroupOffsetFetchTopicResponse
HeartbeatRequest
One Heartbeat v2 exchange; does not schedule subsequent heartbeats.
HeartbeatResponse
JoinedGroupMember
A member and its opaque metadata returned to the group leader.
JoinGroupRequest
JoinGroup v4. An empty member ID starts a dynamic membership handshake. Error 79 (MEMBER_ID_REQUIRED) is returned to the caller without retrying.
JoinGroupResponse
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.
KafkaRecord
A binary record. Null values are tombstones, distinct from empty values.
KafkaRecordHeader
A record header. Duplicate keys and null values are preserved.
KafkaRequest
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.
LeaveGroupRequest
LeaveGroup v2 for a single dynamic member.
LeaveGroupResponse
ListOffsetsPartitionResponse
Broker result for a single partition, without interpreting errorCode.
ListOffsetsRequest
ListOffsets v2 for one explicitly selected partition and earliest/latest.
ListOffsetsResponse
Immutable ListOffsets v2 results, including raw per-partition Kafka errors.
ListOffsetsTopicResponse
Results for one topic; the partition list is copied and immutable.
MemberOffsetCommitRequest
An explicit OffsetCommit v6 carrying a classic member and generation.
MetadataRequest
Kafka MetadataRequest.
MetadataResponse
Represents a response to a MetadataRequest from Kafka.
PartitionData
One uncompressed record batch for an explicitly selected partition.
PartitionMetadata
Represents metadata information about a partition within a Kafka topic.
PartitionResponse
Represents the response for a specific partition in a produce request.
ProduceRequest
Experimental Produce v3 request with uncompressed magic-2 record batches.
ProduceResponse
Decoded experimental Produce v3 response for acknowledged writes.
Record
Backward-compatible record name; payloads are bytes, not implicit JSON.
SyncGroupRequest
SyncGroup v2. Followers send the default empty assignment list.
SyncGroupResponse
TopicData
Records grouped by topic in an experimental Produce v3 request.
TopicMetadata
Represents metadata information about a Kafka topic.
TopicResponse
Represents the response for a specific topic in a produce request.

Enums

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.
KafkaOffsetCommitException
A complete OffsetCommit response reported one or more partition errors.
KafkaResourceLimitException
A configured wire-resource budget was exceeded.