Kafka Streams Group Protocol APIs
Kafka Streams groups use a broker-driven group protocol for membership, topology validation, and active, standby, and warm-up task assignment. These APIs are separate from the classic consumer group protocol and the KIP-848 consumer group protocol.
API Reference
Section titled “API Reference”| API key | Name | Kafka 4.4 versions | Purpose |
|---|---|---|---|
| 88 | StreamsGroupHeartbeat | 0-1 | Join, leave, heartbeat, publish member state, and receive task assignments |
| 89 | StreamsGroupDescribe | 0-1 | Inspect Streams group topology, members, assignments, and status |
| 93 | StreamsGroupTopologyDescriptionUpdate | 0 | Store a detailed processing-topology description |
All three APIs use flexible message encoding. Requests use header version 2 and responses use header version 1 in Kafka 4.4.
StreamsGroupHeartbeat API (Key 88)
Section titled “StreamsGroupHeartbeat API (Key 88)”StreamsGroupHeartbeat is the membership and assignment API for Streams groups. Unlike the classic JoinGroup and SyncGroup exchange, a member sends its state in heartbeats and the coordinator returns incremental assignment information.
Version History
Section titled “Version History”| Version | Kafka | Change |
|---|---|---|
| 0 | 4.0.0 | Initial Streams group protocol |
| 1 | 4.4.0 | Adds AcceptableRecoveryLag, negotiates TopologyDescriptionRequired, and permits MISSING_CLIENT_TAGS |
Request Schema
Section titled “Request Schema”StreamsGroupHeartbeatRequest => group_id: COMPACT_STRING member_id: COMPACT_STRING member_epoch: INT32 endpoint_information_epoch: INT32 instance_id: COMPACT_NULLABLE_STRING rack_id: COMPACT_NULLABLE_STRING rebalance_timeout_ms: INT32 topology: Topology # nullable active_tasks: COMPACT_NULLABLE_ARRAY<TaskIds> standby_tasks: COMPACT_NULLABLE_ARRAY<TaskIds> warmup_tasks: COMPACT_NULLABLE_ARRAY<TaskIds> process_id: COMPACT_NULLABLE_STRING user_endpoint: NULLABLE_Endpoint client_tags: COMPACT_NULLABLE_ARRAY<KeyValue> task_offsets: COMPACT_NULLABLE_ARRAY<TaskOffset> task_end_offsets: COMPACT_NULLABLE_ARRAY<TaskOffset> shutdown_application: BOOLEANThe initial heartbeat uses member_epoch=0 and includes a non-empty topology. A normal heartbeat may omit nullable fields that have not changed. member_epoch=-1 leaves the group; member_epoch=-2 asks a static member to rejoin.
Response Schema
Section titled “Response Schema”StreamsGroupHeartbeatResponse => throttle_time_ms: INT32 error_code: INT16 error_message: COMPACT_NULLABLE_STRING member_id: COMPACT_STRING member_epoch: INT32 heartbeat_interval_ms: INT32 acceptable_recovery_lag_legacy: INT32 # v0 only task_offset_interval_ms: INT32 acceptable_recovery_lag: INT64 # v1+ status: COMPACT_NULLABLE_ARRAY<Status> active_tasks: COMPACT_NULLABLE_ARRAY<TaskIds> standby_tasks: COMPACT_NULLABLE_ARRAY<TaskIds> warmup_tasks: COMPACT_NULLABLE_ARRAY<TaskIds> topology_description_required: BOOLEAN # v1+ endpoint_information_epoch: INT32 partitions_by_user_endpoint: COMPACT_NULLABLE_ARRAY<EndpointToPartitions>topology_description_required=true tells a v1 client to send API 93. Status code 6, MISSING_CLIENT_TAGS, is valid only with v1; v0 clients do not understand it.
Assignment Semantics
Section titled “Assignment Semantics”| Assignment | Meaning |
|---|---|
| Active tasks | Process input and update state stores |
| Standby tasks | Maintain replicated state for failover |
| Warm-up tasks | Restore state before promotion |
Members must fence stale responses by member epoch and must not continue processing tasks revoked by a newer assignment.
StreamsGroupDescribe API (Key 89)
Section titled “StreamsGroupDescribe API (Key 89)”StreamsGroupDescribe returns coordinator state for one or more Streams groups.
Version History
Section titled “Version History”| Version | Kafka | Change |
|---|---|---|
| 0 | 4.0.0 | Group, topology, member, and assignment state |
| 1 | 4.4.0 | Adds IncludeTopologyDescription, topology-description status and data, and AssignorName |
Request Schema
Section titled “Request Schema”StreamsGroupDescribeRequest => group_ids: COMPACT_ARRAY<COMPACT_STRING> include_authorized_operations: BOOLEAN include_topology_description: BOOLEAN # v1+Response Contents
Section titled “Response Contents”Each group result contains its error, group and assignment epochs, initialized topology, members, current and target assignments, and optional authorized operations. Version 1 can additionally return:
| Field | Meaning |
|---|---|
topology_description_status | 0=NOT_REQUESTED, 1=NOT_STORED, 2=ERROR, 3=AVAILABLE |
topology_description | Processing nodes, edges, stores, and global stores when status is AVAILABLE |
assignor_name | Assignor selected for the next assignment computation |
topology_description is non-null only when its status is AVAILABLE.
StreamsGroupTopologyDescriptionUpdate API (Key 93)
Section titled “StreamsGroupTopologyDescriptionUpdate API (Key 93)”Kafka 4.4 adds this API so a group member can push the detailed processing graph requested by StreamsGroupHeartbeat v1.
Request Schema
Section titled “Request Schema”StreamsGroupTopologyDescriptionUpdateRequest => group_id: COMPACT_STRING member_id: COMPACT_STRING topology_epoch: INT32 topology_description: TopologyDescription
TopologyDescription => subtopologies: COMPACT_ARRAY<TopologyDescriptionSubtopology> global_stores: COMPACT_ARRAY<TopologyDescriptionGlobalStore>
TopologyDescriptionNode => name: COMPACT_STRING node_type: INT8 # 1=SOURCE, 2=PROCESSOR, 3=SINK source_topics: COMPACT_ARRAY<COMPACT_STRING> sink_topic: COMPACT_NULLABLE_STRING stores: COMPACT_ARRAY<COMPACT_STRING> successors: COMPACT_ARRAY<COMPACT_STRING>The coordinator validates that member_id still belongs to the group and that topology_epoch is current. A deleted group or mismatched member returns UNKNOWN_MEMBER_ID, causing the client to treat itself as fenced and rejoin.
Response Schema
Section titled “Response Schema”StreamsGroupTopologyDescriptionUpdateResponse => throttle_time_ms: INT32 error_code: INT16 error_message: COMPACT_NULLABLE_STRINGImportant errors include UNKNOWN_MEMBER_ID, GROUP_ID_NOT_FOUND, STREAMS_INVALID_TOPOLOGY_EPOCH, and STREAMS_TOPOLOGY_DESCRIPTION_UPDATE_FAILED.
Protocol Flow
Section titled “Protocol Flow”- The client joins with
StreamsGroupHeartbeatv1,member_epoch=0, and its topology. - The coordinator returns the member epoch, task assignment, heartbeat interval, and
topology_description_requiredflag. - When the flag is true, the client sends
StreamsGroupTopologyDescriptionUpdatev0 and handles any topology validation error. - At each coordinator-provided interval, the client heartbeats with its current tasks and offsets and reconciles any incremental assignment in the response.