DUE TO SPAM, SIGN-UP IS DISABLED. Goto Selfserve wiki signup and request an account.
...
Discussion thread: here
JIRA: TBD
| Jira | ||||||
|---|---|---|---|---|---|---|
|
Please keep the discussion on the mailing list rather than commenting on the wiki (wiki discussions get unwieldy fast).
...
| Configuration name | Description | Values |
|---|---|---|
group.streams.topology.description.plugin.class | The fully qualified class name of a StreamsGroupTopologyDescriptionPlugin implementation. When not set, the feature is disabled. | Type: : |
New Client Configuration
| Configuration name | Description | Values |
|---|---|---|
topology.description.push.enabled | Controls whether the Kafka Streams client sends topology descriptions to the broker when requested. When set to | Type: boolean, Default: true |
...
| Code Block | ||
|---|---|---|
| ||
{ "name": "TopologyDescriptionRequired", "type": "bool", "versions": "N+", "ignorable": true, "default": "false",
"about": "True if the client should send the topology description via UpdateStreamsGroupTopologyDescriptionStreamsGroupTopologyDescriptionUpdate." } |
The broker sets this field to true when a topology description plugin is configured and the broker expects the client to send it's current version of the topology description.
New RPC:
...
StreamsGroupTopologyDescriptionUpdate (API Key TBD)
A new RPC is introduced for setting the topology description for a streams group. Like StreamsGroupHeartbeat, the request is sent to the group coordinator for the group.
...
| Code Block | ||
|---|---|---|
| ||
{
"apiKey": "TBD",
"type": "request",
"listeners": ["broker"],
"name": "UpdateStreamsGroupTopologyDescriptionRequestStreamsGroupTopologyDescriptionUpdateRequest",
"validVersions": "0",
"flexibleVersions": "0+",
"fields": [
{ "name": "GroupId", "type": "string", "versions": "0+", "entityType": "groupId",
"about": "The streams group identifier." },
{ "name": "MemberId", "type": "string", "versions": "0+",
"about": "The ID of the streams group member sending the push." },
{ "name": "TopologyEpoch", "type": "int32", "versions": "0+",
"about": "The epoch of the topology being described." },
{ "name": "TopologyDescription", "type": "TopologyDescription", "versions": "0+",
"about": "The topology description." }
],
"commonStructs": [
{ "name": "TopologyDescription", "versions": "0+", "fields": [
{ "name": "Subtopologies", "type": "[]Subtopology", "versions": "0+",
"about": "The subtopologies that make up this topology." },
{ "name": "GlobalStores", "type": "[]GlobalStore", "versions": "0+",
"about": "Global state stores used by this topology." }
]},
{ "name": "Subtopology", "versions": "0+", "fields": [
{ "name": "SubtopologyId", "type": "string", "versions": "0+",
"about": "The subtopology identifier, unique within the topology." },
{ "name": "Nodes", "type": "[]TopologyNode", "versions": "0+",
"about": "The processing nodes in this subtopology." }
]},
{ "name": "TopologyNode", "versions": "0+", "fields": [
{ "name": "Name", "type": "string", "versions": "0+",
"about": "The name of this node (e.g., KSTREAM-SOURCE-0000000000)." },
{ "name": "NodeType", "type": "int8", "versions": "0+",
"about": "The type of this node: 1=SOURCE, 2=PROCESSOR, 3=SINK." },
{ "name": "SourceTopics", "type": "[]string", "versions": "0+", "entityType": "topicName",
"about": "The source topics this node reads from. Defined only for source nodes, may be empty if source topics are dynamically determined." },
{ "name": "SinkTopic", "type": "string", "versions": "0+", "entityType": "topicName",
"nullableVersions": "0+", "default": "null",
"about": "The topic this node writes to. Defined only for sink nodes, may be null if sink topic is dynamically determined." },
{ "name": "Stores", "type": "[]string", "versions": "0+",
"about": "The state store names accessed by this node. Defined only for processor nodes." },
{ "name": "Successors", "type": "[]string", "versions": "0+",
"about": "The names of successor nodes in the processing graph. Predecessor relationships are reconstructed from this field on the read side." ." }
]},
{ "name": "GlobalStore", "versions": "0+", "fields": [
{ "name": "Source", "type": "TopologyNode", "versions": "0+",
"about": "The source node providing data to the global store." },
{ "name": "Processor", "type": "TopologyNode", "versions": "0+",
"about": "The processor node that populates the global store." }
]}
]
} |
...
| Code Block | ||
|---|---|---|
| ||
{
"apiKey": "TBD",
"type": "response",
"name": "UpdateStreamsGroupTopologyDescriptionResponseStreamsGroupTopologyDescriptionUpdateResponse",
"validVersions": "0",
"flexibleVersions": "0+",
"fields": [
{ "name": "ThrottleTimeMs", "type": "int32", "versions": "0+",
"about": "The duration in milliseconds for which the request was throttled due to a quota violation, or zero if the request did not violate any quota." },
{ "name": "ErrorCode", "type": "int16", "versions": "0+",
"about": "The top-level error code, or 0 if there was no error." },
{ "name": "ErrorMessage", "type": "string", "versions": "0+",
"nullableVersions": "0+", "default": "null",
"about": "The top-level error message, or null if there was no error." }
]
} |
...
GROUP_AUTHORIZATION_FAILED— the client is not authorizedINVALID_REQUEST— the request is malformed , or the plugin semantically rejected the payload by completing its future withInvalidRequestException(including an emptyMemberId)UNSUPPORTED_VERSION— the coordinator cannot serve this RPC because no topology description plugin is configuredTOPOLOGY_DESCRIPTION_TOO_LARGE— the plugin rejected the description because it exceeds the size the plugin is willing to storeSTREAMS_TOPOLOGY_DESCRIPTION_UPDATE_FAILED— the plugin failed to process the request for some other reason; the client logs the underlying error at INFO level. The accompanyingErrorMessagecarries the plugin's exception message. The broker's response shape is identical for both permanent and transient plugin failures; the distinction is broker-internal state that determines whether subsequent heartbeats at the same topology epoch will re-solicit (see Broker Side).
, or the group itself has been deletedUNKNOWN_MEMBER_ID— the member named inMemberIdis no longer in the group; the client should treat itself as fenced and rejoin
GROUP_ID_NOT_FOUND— the specified group does not existNOT_COORDINATOR— the broker is not the coordinator for this groupCOORDINATOR_NOT_AVAILABLE— the coordinator is not availableCOORDINATOR_LOAD_IN_PROGRESS— the coordinator is loading
...
Client-side retry behavior for each code is described in Error Handling and Retries Client Side below.
StreamsGroupDescribeRequest Change
...
| Code Block | ||||
|---|---|---|---|---|
| ||||
{"name": "IncludeTopologyDescription", "type": "bool", "versions": "N+", "ignorable": true, "default": "false",
"about": "Whether to include the full topology description from the topology description plugin in the response." } |
A client that negotiates an older version is handled unchanged by any broker. The flag may only be set when version N or later is negotiatedClients on older versions never see the flag and behave unchanged.
StreamsGroupDescribeResponse Change
...
| Code Block | ||||
|---|---|---|---|---|
| ||||
{ "name": "TopologyDescription", "type": "TopologyDescription", "versions": "N+",
"nullableVersions": "N+", "ignorable": true, "default": "null",
"about": "The topology description for this group. Null if not available — see TopologyDescriptionStatus for the reason." },
{ "name": "TopologyDescriptionStatus", "type": "int8", "versions": "N+", "ignorable": true, "default": "0",
"about": "The status of the topology description for this group: 0=NOT_REQUESTED (client did not set IncludeTopologyDescription), 1=NOT_STORED (no topology description has been recorded for this group), 2=ERROR (the broker failed to fetch the topology description; check broker logs), 3=AVAILABLE (a topology description is present in the TopologyDescription field)." }The broker MUST set this field to AVAILABLE whenever it attaches a TopologyDescription." } |
The TopologyDescription common struct mirrors the struct used by StreamsGroupTopologyDescriptionUpdateRequest (same field names and shape). The nested struct names are prefixed TopologyDescription to avoid collision with the existing Subtopology struct already defined for the describe response. Because The TopologyDescription common struct mirrors the struct used by UpdateStreamsGroupTopologyDescriptionRequest (same field names and shape). Because Kafka RPC schemas do not share common structs across message files, the struct is duplicated in StreamsGroupDescribeResponse.json.Setting Setting these fields does not change the ErrorCode on the DescribedGroup: a group with a successful describe but a missing or failed topology fetch still returns ErrorCode=NONE. The TopologyDescriptionStatus field tells the caller why TopologyDescription is null, so that "waiting for first push" (NOT_STORED) can be distinguished from "broker-side fetch failed" (ERROR) without an error-level change to the describe result.
Plugin Interface
DeleteGroupsResponse Change
DeleteGroupsRequest and DeleteGroupsResponse are both bumped to the next version (3). The request shape is unchanged at the new version; the response adds an ErrorMessage field to each per-group DeletableGroupResultA new interface is introduced in org.apache.kafka.coordinator.group.api.streams :
| Code Block | ||||
|---|---|---|---|---|
| ||||
package org.apache.kafka.coordinator.group.api.streams;
import org.apache.kafka.common.Configurable;
import java.util.concurrent.CompletableFuture;
/**
* A broker-side plugin that manages topology descriptions for streams groups.
*
* <p>Implementations receive topology descriptions pushed by Kafka Streams clients
* and can store, forward, or expose them however they see fit. The broker is
* authoritative on whether a topology is currently stored: it persists a
* {@code StoredTopologyEpoch} field on the streams-group metadata record and uses it
* to decide whether to solicit a fresh push on the heartbeat path. Plugins therefore
* do not need to maintain a per-tuple state machine to answer "do I have this?" —
* that question has a broker-side answer.
*
* <p>Implementations must be thread-safe. {@link #setTopology} may be called
* concurrently by multiple group members observing
* {@code TopologyDescriptionRequired=true} in the same heartbeat cycle; concurrent
* calls with the same {@code (groupId, topologyEpoch)} pair carry identical data
* and must be treated as idempotent. {@link #deleteTopology} may be called multiple
* times for the same {@code groupId} if a prior call's bookkeeping write failed; it
* must also be idempotent when the group has no stored topology.
*/
public interface StreamsGroupTopologyDescriptionPlugin extends Configurable, AutoCloseable {
/**
* Called when a client sends a topology description for a streams group.
* This method may be called concurrently by multiple members of the same group;
* all calls for the same (groupId, topologyEpoch) carry identical data.
*
* <p>The returned future completes when the topology has been persisted or
* forwarded. All failures must be signalled by completing the returned future
* exceptionally — implementations must not throw synchronously from this method.
* The broker handles the future's completion exception (when present) as follows:
*
* <ul>
* <li>{@link org.apache.kafka.common.errors.InvalidRequestException} maps to
* {@code INVALID_REQUEST} — use it for payloads the plugin cannot accept on
* semantic grounds. The broker persists this as a permanent-failure
* {@code LastFailedTopologyEpoch} so subsequent heartbeats do not re-solicit
* at the same topology epoch.</li>
* <li>{@link org.apache.kafka.common.errors.TopologyDescriptionTooLargeException}
* maps to {@code TOPOLOGY_DESCRIPTION_TOO_LARGE} — use it when the description
* is larger than the plugin is willing to store. Same permanent-failure
* treatment as above.</li>
* <li>Any other exception maps to {@code TOPOLOGY_DESCRIPTION_UPDATE_FAILED} and is
* logged at WARN. The broker treats it as transient and arms an in-memory back-off
* for this (groupId, topologyEpoch): the heartbeat path will not re-solicit a fresh
* push until the back-off window has elapsed. Consecutive transient failures double
* the back-off, starting at 30 s and capped at 1 h; a successful push or a
* topology-epoch advance clears the state.</li>
* </ul>
*
* @param groupId the streams group ID
* @param topologyEpoch the topology epoch
* @param description the topology description
* @return a future that completes when the operation is done
*/
CompletableFuture<Void> setTopology(String groupId, int topologyEpoch,
StreamsGroupTopologyDescription description);
/**
* Called when the broker removes a streams group. Removes any topology
* descriptions stored for this group.
*
* <p>Invoked on two paths: when a client deletes the group via {@code DeleteGroups}
* (before the group tombstone is written), and from the broker-internal periodic
* topology-description cleanup when a streams group becomes empty and all its
* offsets have expired.
*
* <p>The returned future completes when the deletion has been processed.
* If it completes exceptionally, the broker logs the error; the outcome does not
* affect the user-visible result of the operation that triggered the removal.
* The broker may call this method multiple times for the same {@code groupId} if a
* prior call's bookkeeping write failed — implementations must be idempotent.
*
* @param groupId the streams group ID
* @return a future that completes when the operation is done
*/
CompletableFuture<Void> deleteTopology(String groupId);
/**
* Called to retrieve the stored topology description for a group. This is invoked
* by the broker when a client calls StreamsGroupDescribe with
* {@code IncludeTopologyDescription=true}, but only when the broker-side
* {@code StoredTopologyEpoch} matches the group's current topology epoch — otherwise
* the describe path returns {@code NOT_STORED} without invoking this method.
*
* <p>Returns a future that resolves to the stored topology description for the
* given {@code (groupId, topologyEpoch)} pair, or to {@code null} if the plugin has
* lost its data (e.g. backend wipe). In that case the broker self-heals by clearing
* {@code StoredTopologyEpoch} so the next heartbeat re-solicits a fresh push.
*
* <p>If the future completes exceptionally, the broker signals a read error for this
* group.
*
* @param groupId the streams group ID
* @param topologyEpoch the topology epoch the caller is asking about
* @return a future resolving to the stored topology description, or null if none
*/
CompletableFuture<StreamsGroupTopologyDescription> getTopology(String groupId, int topologyEpoch);
} | ||||
{ "name": "ErrorMessage", "type": "string", "versions": "3+", "nullableVersions": "3+", "ignorable": true, "default": "null",
"about": "The error message, or null if there was no error." } |
A new generic error code is added to the per-group ErrorCode slot:
GROUP_DELETION_FAILED— the delete operation could not complete; the accompanyingErrorMessagedescribes the underlying cause. The group is not tombstoned, and the caller may retry once the underlying condition is resolved. For streams groups configured with a topology description plugin this is returned whenplugin.deleteTopologyfails; other group types may adopt the same code in the future.
This is the only deletion-blocking failure mode introduced by this KIP. Consumer and share groups are unaffected. See Broker Side for the full ordering rule and the recovery path.
Plugin Interface
A new interface is introduced in org.apache.kafka.coordinator.group.api.streams :
| Code Block | ||||
|---|---|---|---|---|
| ||||
/**
* A broker-side plugin that stores, forwards, or exposes topology descriptions pushed
* by Kafka Streams clients.
*
* <p>Implementations must be thread-safe. {@link #setTopology} may be called
* concurrently by multiple members of the same group; calls with the same
* {@code (groupId, topologyEpoch)} carry identical data and must be idempotent.
* {@link #deleteTopology} must also be idempotent — it may be called more than once
* for the same {@code groupId}, including when nothing is stored.
*/
@InterfaceStability.Evolving
public interface StreamsGroupTopologyDescriptionPlugin extends Configurable, AutoCloseable {
/**
* Store the topology description for a streams group.
*
* <p>The returned future completes when the topology has been persisted or forwarded.
* Failures must be signalled by completing the future exceptionally — implementations
* must not throw synchronously. The completion exception drives broker-side behaviour:
*
* <ul>
* <li>{@link StreamsTopologyDescriptionPermanentFailureException} — the description will never be accepted
* at this topology epoch (e.g. too large, semantically rejected). The broker
* ratchets {@code LastFailedTopologyEpoch} and stops re-soliciting until the
* epoch advances.</li>
* <li>{@link StreamsTopologyDescriptionTransientFailureException} or any other exception — treated as
* transient. The broker arms or extends the per-group back-off (30 s → 1 h,
* exponential) and re-solicits on a later heartbeat.</li>
* </ul>
*
* In both cases the caller receives error code
* {@code STREAMS_TOPOLOGY_DESCRIPTION_UPDATE_FAILED} with the exception's message in
* {@code ErrorMessage}; the permanent-vs-transient split is broker-internal state.
*/
CompletableFuture<Void> setTopology(String groupId, int topologyEpoch,
StreamsGroupTopologyDescription description);
/**
* Remove any topology description stored for this group. Called when the group is
* deleted or expires. A failure (future completed exceptionally) is reported to the
* caller of {@code DeleteGroups} as {@code GROUP_DELETION_FAILED} with the exception message
* in the per-group {@code ErrorMessage}, and the broker does not tombstone the group;
* a retry of {@code DeleteGroups} re-invokes this method idempotently. The
* periodic-cleanup path treats a failure identically — the group's tombstone is
* deferred to a future cycle.
*/
CompletableFuture<Void> deleteTopology(String groupId);
/**
* Return the stored topology description for {@code (groupId, topologyEpoch)}, or
* {@code null} if the plugin no longer has the data (e.g. backend wipe). If the future
* completes exceptionally, the broker reports a read error for the group.
*/
CompletableFuture<StreamsGroupTopologyDescription> getTopology(String groupId, int topologyEpoch);
} |
The plugin uses a StreamsGroupTopologyDescription POJO that mirrors org.apache.kafka.streams.TopologyDescription but lives in the org.apache.kafka.coordinator.group.api.streams package; plugin implementations only need to depend on group-coordinator-api. The only difference is that there is no predecessor relation.
| Code Block | ||||
|---|---|---|---|---|
| ||||
package org.apache.kafka.coordinator.group.api.streams;
public class StreamsGroupTopologyDescription {
public Collection<Subtopology> subtopologies();
public Collection<GlobalStore> globalStores();
public static final class Subtopology {
public String id();
public Collection<Node> nodes();
}
/**
* A processing node in the topology. Predecessor nodes can be inferred from successor relation.
*/
public sealed interface Node {
String name();
Set<String> successors();
}
public static final class Source implements Node {
public Set<String> topics();
}
public static final class Processor implements Node {
public Set<String> stores();
}
public static final class Sink implements Node {
public Optional<String> topic();
}
public static final class GlobalStore {
public Source source();
public Processor processor();
}
} |
Two new exception classes in the same package let the plugin signal the permanent-vs-transient distinction. Plugins that throw any other exception are treated as transient:The plugin uses a StreamsGroupTopologyDescription POJO that mirrors org.apache.kafka.streams.TopologyDescription but lives in the org.apache.kafka.coordinator.group.api.streams package; plugin implementations only need to depend on group-coordinator-api. The only difference is that there is no predecessor relation.
| Code Block | ||||
|---|---|---|---|---|
| ||||
package org.apache.kafka.coordinator.group.api.streams; public class StreamsGroupTopologyDescription { public Collection<Subtopology> subtopologies(); public Collection<GlobalStore> globalStores(); public static class Subtopology { public String id(); public Collection<Node> nodes(); } /** * A processing node in the topology. Predecessor nodes can be inferred from successor relation. */ public interface Node { String name(); Set<String> successors(); } public static class Source implements Nodeimport org.apache.kafka.common.errors.ApiException; import org.apache.kafka.common.annotation.InterfaceStability; /** Signals that the topology description for the current epoch will never be accepted (e.g. too large, semantically rejected). */ @InterfaceStability.Evolving public class StreamsTopologyDescriptionPermanentFailureException extends ApiException { public StreamsTopologyDescriptionPermanentFailureException(String message) { public Set<String> topicssuper(message); } public static class Processor implements Node { public Set<String> stores(); } public static class Sink implements Node { public Optional<String> topic(); } public static class GlobalStoreStreamsTopologyDescriptionPermanentFailureException(String message, Throwable cause) { super(message, cause); } } /** Signals a transient backend failure; the broker re-solicits on a later heartbeat. Plugins that throw any other exception are treated identically. */ @InterfaceStability.Evolving public class StreamsTopologyDescriptionTransientFailureException extends ApiException { public StreamsTopologyDescriptionTransientFailureException(String message) { public Source sourcesuper(message); } public StreamsTopologyDescriptionTransientFailureException(String message, Throwable publiccause) Processor{ processorsuper(message, cause); } } |
Broker-Side Persistence
...
| Code Block | ||||
|---|---|---|---|---|
| ||||
{ "name": "StoredTopologyEpoch", "versions": "0+", "taggedVersions": "0+", "tag": 3,
"default": -1, "type": "int32",
"about": "The topology epoch whose description is currently stored in the topology description plugin, or -1 if none is stored." },
{ "name": "LastFailedTopologyEpoch", "versions": "0+", "taggedVersions": "0+", "tag": 4,
"default": -1, "type": "int32",
"about": "The topology epoch whose description push the plugin permanently rejected (TooLargesignalled /by InvalidRequestStreamsTopologyDescriptionPermanentFailureException), or -1 if none. Heartbeat-path solicitation is suppressed while this equals the current topology epoch, to avoid hot-looping." } |
...
Optional<StreamsGroupTopologyDescription> topologyDescription()— empty unless the field was requested and the plugin returned a description.
AVAILABLE,StreamsGroupTopologyDescriptionStatus topologyDescriptionStatus()— a new enum{
non-null; the remaining values mirror the wire-levelNOT_REQUESTED, NOT_STORED, ERROR, AVAILABLE }. Each enum value's ordinal matches the wire-levelTopologyDescriptionStatusint8 (0, 1, 2, 3).AVAILABLEis reported whenTopologyDescriptionisTopologyDescriptionStatusint8non-null.
The Admin client exposes a POJO hierarchy in org.apache.kafka.clients.admin that mirrors org.apache.kafka.streams.TopologyDescription but lives in the clients module. The admin client converts the wire-format struct into this hierarchy.
| Code Block | ||||
|---|---|---|---|---|
| ||||
package org.apache.kafka.clients.admin;
public class StreamsGroupTopologyDescription {
public Collection<Subtopology> subtopologies();
public Collection<GlobalStore> globalStores();
public static final class Subtopology {
public String id();
public Collection<Node> nodes();
}
public interface Node {
String name();
/** Direct predecessor nodes. */
Set<String> predecessors();
/** Direct successor nodes. */
Set<String> successors();
}
public static final class Source implements Node {
public Set<String> topics();
}
public static final class Processor implements Node {
public Set<String> stores();
}
public static final class Sink implements Node {
public Optional<String> topic();
}
public static final class GlobalStore {
public Source source();
public Processor processor();
}
} |
...
The sequence below traces the four user-visible interactions — a successful push, a describe, an explicit DeleteGroups, and broker-driven cleanup of a naturally-expired group. Plugin calls return CompletableFutures; the broker awaits them asynchronously.
Broker Side
The plugin is instantiated at broker startup if
group.streams.topology.description.plugin.classis configured. A broker without a plugin returnsUNSUPPORTED_VERSIONforStreamsGroupTopologyDescriptionUpdateand never setsTopologyDescriptionRequired, so the RPC is only sent against a plugin-configured broker.After a successful
membersStreamsGroupHeartbeat, the broker decides whether to setTopologyDescriptionRequired=truepurely from the group's persisted state — no plugin RPC is involved. Members withSTALE_TOPOLOGYstatus are skipped. For all other members
,the broker sets the flag iff
:
transient-failureStoredTopologyEpoch != currentTopologyEpochANDLastFailedTopologyEpoch != currentTopologyEpochAND no per-groupback-off is
currentlyin its window. The back-off is in-memory state
on the service(keyed by
, armed whengroupId, carryingtopologyEpoch+nextAttemptMs)that arms or extends every time the flag is set and additionally on a transient
is observed and doubled per consecutive failure starting at 30 s and capped at 1 h; it is clearedsetTopologyfailure; consecutive arms double the window from 30 s up to 1 h. It clears on a successful push, on a permanent failure (
becausewhere
the same epochLastFailedTopologyEpochratchets), and implicitly on any topology-epoch advance
(a stale entry for an older epoch is ignored). A service-side in-flight tracker (pergroupId, default 30 s) is additionally used to prevent multiple concurrent heartbeats from each setting the flag.. The same mechanism covers unresponsive plugins and clients that never push (for example, with
topology.description.push.enabled=false).On
OnStreamsGroupTopologyDescriptionUpdateUpdateStreamsGroupTopologyDescription, the broker checks the
. The brokerREADACL on the group and that a plugin is configured, then validates the
against the streams groupMemberId: an empty
MemberIdis rejected withINVALID_REQUEST, aMemberIdthat does not match any current member of the group is rejected withUNKNOWN_MEMBER_ID, and a request whose group ID does not name an existing streams group is also rejectednon-existing streams group with
(the group-deleted case is observationally identical to a member fence from the client's point of view, and is handled by the same rejoin path)GROUP_ID_NOT_FOUND, and aMemberIdnot matching any current member withUNKNOWN_MEMBER_ID. The broker
does not enforce aenforces no size limit
on the topology description — it is the plugin's responsibility to decide what size; the plugin decides what it is willing to store. The broker then calls
the brokersetTopologyon the plugin. On successit writes a metadata record setting
,StoredTopologyEpoch = pushedEpochand the response carries
OnNONE.InvalidRequestException(mapped toINVALID_REQUEST) orTopologyDescriptionTooLargeException(mapped toTOPOLOGY_DESCRIPTION_TOO_LARGE), the broker writes a metadata record settingOn
topologyStreamsTopologyDescriptionPermanentFailureExceptionit writesLastFailedTopologyEpoch = pushedEpochso subsequent heartbeats at the sameepoch do not re-solicit.
Any other exception maps toTOPOLOGY_DESCRIPTION_UPDATE_FAILED, is logged at WARN, and is treated as transient — no metadata record is writtenOn
subsequentStreamsTopologyDescriptionTransientFailureExceptionor any other exception it writes no metadata record, arms the per-group back-off, and the next heartbeat re-solicits once the window elapses. In both failure cases the response carriesSTREAMS_TOPOLOGY_DESCRIPTION_UPDATE_FAILEDwith the plugin's exception message inErrorMessage; the permanent-vs-transient split is broker-internal state. If the plugin call succeeds but themetadata-record write fails, the
broker accepts the drift: thenext heartbeat sees
StoredTopologyEpoch < currentTopologyEpoch, re-solicits, the client re-pushes the identical payload, the plugin's idempotentsetTopologyis invoked again, and the metadata-record write is retried — closingthe drift, re-solicits, and the idempotent re-push closes the gap.
- On
On
that hasDeleteGroups, the broker callsdeleteTopologyon the plugin before writing the group tombstone, for each requested streams groupwith
-1.StoredTopologyEpoch !=deleteTopologyfailures are logged but do not affect the deletion response. The group is then tombstoned regardless of the per-group plugin outcome
broker-driven-1. On plugin success the group is tombstoned and the per-groupErrorCodeisNONE. On plugin failure the group is not tombstoned and the per-groupErrorCodeis set toGROUP_DELETION_FAILEDwith the plugin's exception message inErrorMessage(also logged at WARN); the operator retries the request once the plugin recovers, or unsets the plugin config to bypass it. Other groups in the same batch are unaffected — the failure is reported per group. This ordering matches thenatural-expiration cleanup
(next bullet), where the plugin is also called before the group is tombstonedbelow, which also defers tombstoning until
plugin.deleteTopologysucceeds. - On
StreamsGroupDescribewithIncludeTopologyDescription=true, the broker callsgetTopologyon the plugin only whenStoredTopologyEpoch == currentTopologyEpochfor that group; otherwise it reportsNOT_STOREDwithout making a plugin call. Calls across groups run in parallel. Authorization is unchanged — the existingDESCRIBEACL on the GROUP resource covers the topology description.DescribedGroup.ErrorCodeis never modified by topology-related outcomes; theTopologyDescriptionStatusfield carries the reason whenTopologyDescriptionis null (NOT_REQUESTED,NOT_STORED, orERROR; the last is also logged at WARN). When With no plugin is configured , the broker returns returnsNOT_STORED. If AgetTopologyreturnsnullwhile the broker believed the description was stored call returningnull(plugin-side data - loss) , the broker schedules a fire-and-forget write resettingStoredTopologyEpoch = -1so the next heartbeat re-solicits a fresh pushsurfaces asNOT_STOREDand is logged at WARN; subsequent describes keep returningNOT_STOREDuntil the topology epoch advances or an operator clears plugin state. - When a plugin is configured, the broker runs a periodic topology-description cleanup every
offsets.retention.check.interval.ms. Each fire fans out a read-only query across the broker's hosted__consumer_offsetspartitions to identify streams groups eligible for cleanup:isEmpty && allOffsetsExpired && StoredTopologyEpoch != -1. This is the same eligibility predicate the shard's offset-expiration sweep uses to delete consumer/share groups, with the additionalStoredTopologyEpoch != -1filter. For each eligible group, the broker callsplugin.deleteTopology(groupId)and, on success, writes a metadata record settingStoredTopologyEpoch = -1. Plugin failures leave the field set; the same group is retried on the next cycle. OnceStoredTopologyEpoch = -1, the shard's offset-expiration sweep tombstones the (now flag-cleared) group on a subsequent cycle. When no plugin is configured, the periodic cleanup does not run and the shard's offset-expiration sweep expires streams groups normally, ignoringStoredTopologyEpoch; operators that disable a previously-configured plugin are responsible for cleaning up plugin-side state out-of-band.
...
- At startup, if
topology.description.push.enabled=true, the Streams client converts the topology returned byTopology#describe()to the wire format and stores it internally. The mapping is one-to-one with the RPC schema; predecessor edges are not sent on the wire and the read side reconstructs them by inverting each node's successor list. Whentopology.description.push.enabled=false, no description is stored and the feature is disabled on this client. - The Streams client records the
TopologyDescriptionRequiredflag from each heartbeat response. - On each consumer background-thread poll, the client sends
UpdateStreamsGroupTopologyDescriptionStreamsGroupTopologyDescriptionUpdateto the coordinator when a coordinator is known, the flag is set, a stored topology description is available, the client has a non-empty member ID assigned by the coordinator, and no prior request is in flight. The member ID populated on the request is the same one carried onStreamsGroupHeartbeat. The push runs on the consumer background thread and never blocks user-facing Kafka Streams APIs; the push is best-effort. Completion handling on the push response is keyed on the error code.
broker no longer recognizes this member (group deleted, or member dropped)NOT_COORDINATORandCOORDINATOR_NOT_AVAILABLEtrigger coordinator rediscovery and leave the flag set.COORDINATOR_LOAD_IN_PROGRESSand network exceptions leave the flag set for retry on the next poll.UNKNOWN_MEMBER_IDmeans themember has been dropped from the group: the client clears the flag and relies on the existing membership-management path to trigger a clean rejoin on the next heartbeat. All other errors (
TOPOLOGY_DESCRIPTION_TOO_LARGE,STREAMS_TOPOLOGY_DESCRIPTION_UPDATE_FAILED,INVALID_REQUEST,UNSUPPORTED_VERSION,GROUP_ID_NOT_FOUND,GROUP_AUTHORIZATION_FAILED) clear the flag and log at WARN with the response'sErrorMessage; the client does not retry on its own, and a re-attempt happens only when the broker re-sets the flag via a subsequent heartbeat. A non-zeroThrottleTimeMson the response delays the next push attempt by that amount, as with other request managers.
Plugin Implementation Guidelines
...
- Treat
setTopology(on(groupId, topologyEpoch)) anddeleteTopology(on(groupId)) as idempotent; the broker may re-issue an identical call when an earlier call's bookkeeping write failed. - Be thread-safe under concurrent invocation:
setTopologymay be called by multiple members of the same group in the same heartbeat cycle, and the periodic-cleanup path may invokedeleteTopologywhile a member is mid-push. - Reject payloads the plugin will not accept by completing the the
setTopologyfuture withTopologyDescriptionTooLargeExceptionorInvalidRequestExceptionStreamsTopologyDescriptionPermanentFailureException; the broker persists the rejection at the epoch level viaLastFailedTopologyEpochand stops re-soliciting at the same epoch. The exception message reaches the client inErrorMessage. - Signal transient storage-layer failures by completing the the
setTopologyfuture withStreamsTopologyDescriptionTransientFailureException(or any other exception); the broker's transientper-failure group back-off (30 s → 1 h, exponential) throttles re-solicitation. - Return Return
nullfromgetTopologywhen the plugin has lost its datathe description; the broker clearsStoredTopologyEpochreportsNOT_STOREDon the next describe so a fresh push is re-soliciteddescribe response. Exceptions are reserved for transient backend failures and surface asERROR. - Avoid blocking coordinator threads (plugin methods may be invoked on them) and complete futures within seconds, not minutes; the broker applies no wall-clock deadline to plugin calls, so the coordinator's responsiveness is bounded by what the plugin does. Bound plugin-side state explicitly — the plugin shares the broker heap.
...
The topology description contains user-defined processor names, state-store names, and topic names. This KIP does not treat these as inherently sensitive and does not introduce any client-side redaction. Operators who consider node, store, or topic names sensitive should scope DESCRIBE ACLs on the GROUP resource accordingly: the same ACL that guards StreamsGroupDescribe guards the TopologyDescription field on the response. The UpdateStreamsGroupTopologyDescription StreamsGroupTopologyDescriptionUpdate path is guarded by READ on the GROUP, identical to the existing heartbeat ACL.
...
| MBean | Type | Description | |||
|---|---|---|---|---|---|
kafka.server:type=group-coordinator-metrics,name=streams-group-topology-description-plugin-set-success-{rate,count} | Meter | Successful plugin.setTopology calls. | |||
kafka.server:type=group-coordinator-metrics,name=streams-group-topology-description-plugin-set-error-{rate,count} | Meter | Failed TopologyDescriptionTooLargeException InvalidRequestException | |||
kafka.server:type=group-coordinator-metrics,name=streams-group-topology-description-plugin-delete-success-{rate,count} | Meter | Successful plugin.deleteTopology calls (covers both the explicit DeleteGroups and periodic-cleanup paths). | |||
kafka.server:type=group-coordinator-metrics,name=streams-group-topology-description-plugin-delete-error-{rate,count} | Meter | Failed plugin.deleteTopology calls. | |||
kafka.server:type=group-coordinator-metrics,name=streams-group-topology-description-plugin-get-success-{rate,count} | Meter | Successful plugin.getTopology calls. | |||
kafka.server:type=group-coordinator-metrics,name=streams-group-topology-description-plugin-get-error-{rate,count} | Meter | Failed plugin.getTopology calls. | |||
kafka.server:type=group-coordinator-metrics,name=streams-group-topology-description-cleanup-cycle-{rate,count} | Meter | Periodic topology-description cleanup cycles that actually ran. | |||
kafka.server:type=group-coordinator-metrics,name=topology-description-cleanup-skipped-{rate,count} | Meter | Cycles skipped by the single-flight guard because a prior cycle was still in flight. | kafka.server:type=group-coordinator-metrics,name=streams-group-topology-description-cleanup-eligible-{rate,count} | Meter | Streams group IDs identified as eligible for topology-description cleanup, summed across partitions. |
...
Without a configured plugin, no flags are set and no topology descriptions are sent. There is no behavioral change for existing deployments.
Rolling Upgrades
During a rolling upgrade of brokers, some brokers may have the plugin configured and some may not. The TopologyDescriptionRequired flag is only set by plugin-equipped coordinators; a client whose current coordinator lacks the plugin never sees the flag. If the coordinator migrates mid-push to a plugin-less broker, the client receives UNSUPPORTED_VERSION, clears the topologyDescriptionRequired flag, and does not retry. The flag is set again only if a future heartbeat response from a plugin-equipped coordinator includes TopologyDescriptionRequired=true.
During a rolling upgrade of the Streams application (topology epoch change), the broker skips the heartbeat-path gating for STALE_TOPOLOGY members — the response flag is not set, regardless of the persisted StoredTopologyEpoch. Only members running the new topology reach the gating comparison. If every active member is stale during the rollout, the current-epoch topology remains uncaptured until at least one member heartbeats with the new epoch.
During this transition the assignment topology (advanced synchronously when a new-epoch member heartbeats) and the description topology (advanced asynchronously via the plugin) can briefly disagree: StreamsGroupDescribe may report the new topologyEpoch while TopologyDescription is still null with status NOT_STORED until the first push for the new epoch succeeds. The two reconverge once any member at the new epoch pushes its description.
Future Work
Hash-based mismatch detection. A future enhancement could introduce a topology hash to detect clients on different topology descriptions reporting the same topology epoch.
Multi-version describe. The describe response surfaces only the topology under the group's current topologyEpoch. During a rolling topology upgrade, the previous epoch's description is still stored by the plugin but is no longer reachable via describe. A natural extension is a descriptions[] array on the response, tagged by epoch, allowing operators to view both the previous and the in-flight new topology while the rollout completes.
Node grouping. A nodeGroup field on TopologyNode for UI grouping, requiring an extension to the public TopologyDescription.Node interface in Kafka Streams — best addressed in a follow-up KIP.
Test Plan
Integration Tests
- A Streams client pushes its topology description after the broker requests it, the configured plugin receives the description, and the group's
StoredTopologyEpochis updated to the pushed epoch. - A broker without a topology description plugin never asks the client to push and rejects pushes outright.
- Authorization is enforced on the new RPC.
- A plugin completing the
setTopologyfuture withTopologyDescriptionTooLargeExceptioncauses the broker to returnTOPOLOGY_DESCRIPTION_TOO_LARGE, persistsLastFailedTopologyEpoch = pushedEpoch, and subsequent heartbeats at the same epoch do not re-solicit. - A
setTopologyplugin success followed by an injected metadata-record commit failure recovers on the next heartbeat: the broker re-solicits, the client re-pushes, the plugin's idempotentsetTopologyis invoked a second time, andStoredTopologyEpochends up correctly set. - Requesting a topology description via describe returns it for groups whose
StoredTopologyEpochmatches the current epoch, and surfacesNOT_STORED(no description stored or epoch mismatch) orERROR(plugin exception) otherwise — without turning the describe itself into an error. - A
getTopologyreturningnullwhile the broker believed the description was stored triggers a fire-and-forgetStoredTopologyEpoch = -1write; the next heartbeat re-solicits. - An explicit
DeleteGroupsfor a streams group withStoredTopologyEpoch != -1callsplugin.deleteTopologybefore tombstoning the group; the group is tombstoned even if the plugin call fails. - A push from a member that no longer belongs to the group (or whose group has been deleted) is rejected with
UNKNOWN_MEMBER_ID; the client clears its push flag and rejoins via the existing heartbeat-fence path. A push with an emptyMemberIdis rejected withINVALID_REQUEST. - The CLI prints the topology when it is available and reports a clear, distinct message for each non-available outcome, with exit code 0 only when the topology is actually returned.
System Tests
DeleteGroupsRequest and DeleteGroupsResponse are bumped to version 3, which adds a per-group ErrorMessage field on the response and introduces the new GROUP_DELETION_FAILED error code. Older admin clients negotiate version 2 and never see the new field; they continue to receive only the per-group ErrorCode. DeleteGroups can newly fail on streams groups when a topology description plugin is configured and its deleteTopology call fails. Brokers without a configured plugin keep today's behaviour. Older clients that do receive GROUP_DELETION_FAILED (because they understand version 3 but predate this KIP's error-code addition) decode the code as UNKNOWN_SERVER_ERROR via the standard forward-compatibility fallback in Errors.forCode; the group is still not tombstoned, so an idempotent retry of DeleteGroups converges once the plugin recovers. No client-side change is required.
Rolling Upgrades
During a rolling upgrade of brokers, some brokers may have the plugin configured and some may not. The TopologyDescriptionRequired flag is only set by plugin-equipped coordinators; a client whose current coordinator lacks the plugin never sees the flag. If the coordinator migrates mid-push to a plugin-less broker, the client receives UNSUPPORTED_VERSION, clears the topologyDescriptionRequired flag, and does not retry. The flag is set again only if a future heartbeat response from a plugin-equipped coordinator includes TopologyDescriptionRequired=true.
During a rolling upgrade of the Streams application (topology epoch change), the broker skips the heartbeat-path gating for STALE_TOPOLOGY members — the response flag is not set, regardless of the persisted StoredTopologyEpoch. Only members running the new topology reach the gating comparison. If every active member is stale during the rollout, the current-epoch topology remains uncaptured until at least one member heartbeats with the new epoch.
During this transition the assignment topology (advanced synchronously when a new-epoch member heartbeats) and the description topology (advanced asynchronously via the plugin) can briefly disagree: StreamsGroupDescribe may report the new topologyEpoch while TopologyDescription is still null with status NOT_STORED until the first push for the new epoch succeeds. The two reconverge once any member at the new epoch pushes its description.
Future Work
Hash-based mismatch detection. A future enhancement could introduce a topology hash to detect clients on different topology descriptions reporting the same topology epoch.
Multi-version describe. The describe response surfaces only the topology under the group's current topologyEpoch. During a rolling topology upgrade, the previous epoch's description is still stored by the plugin but is no longer reachable via describe. A natural extension is a descriptions[] array on the response, tagged by epoch, allowing operators to view both the previous and the in-flight new topology while the rollout completes.
Node grouping. A nodeGroup field on TopologyNode for UI grouping, requiring an extension to the public TopologyDescription.Node interface in Kafka Streams — best addressed in a follow-up KIP.
Test Plan
Integration Tests
Broker
StreamsGroupTopologyDescriptionUpdateRequestTest(new) — push happy path;StreamsTopologyDescriptionPermanentFailureException(ratchetsLastFailedTopologyEpoch) andStreamsTopologyDescriptionTransientFailureException(arms back-off) both surface asSTREAMS_TOPOLOGY_DESCRIPTION_UPDATE_FAILEDwith the cause inErrorMessage; heartbeat-flag gating; member/group/MemberIdfencing; explicitDeleteGroupsplugin-success path (tombstone written) and plugin-failure path (GROUP_DELETION_FAILEDreturned withErrorMessage, group not tombstoned, retry converges after plugin recovery).StreamsGroupTopologyDescriptionUpdateNoPluginRequestTest(new) — broker without plugin: pushes rejected, flag never set, describe returnsNOT_STORED.AuthorizerIntegrationTest—READACL on the GROUP resource for the new RPC.
Streams client
TopologyDescriptionPluginIntegrationTest(new) — end-to-end push against an in-memory plugin; describe status mapping;topology.description.push.enabled=falseopt-out.
CLI
TopologyDescriptionFormatterTest(new) — eachTopologyDescriptionStatus, the pretty-print format, and the exit-code mapping.StreamsGroupCommandTest— the--topologysub-action against a populated group.
System Tests
New ducktape suite streams_topology_description_plugin_test.py driving the Java harness TopologyDescriptionPluginSystemTest:
StreamsTopologyDescriptionPluginTest— CLI describe of a running Kafka Streams app; client opt-out; periodic-cleanup-after-retention. The last scenario lives here because realisticoffsets.retention.minutesis minutes-to-hours; overriding it low enough at the integration layer would affect unrelated tests on the shared embedded cluster.StreamsTopologyDescriptionPluginNoPluginTest— broker without plugin reportsNOT_STOREDand never asks the client to push- A running Kafka Streams application pushes its topology and an operator can retrieve and pretty-print it via the CLI end-to-end.
Disabling the feature on the client (
topology.description.push.enabled=false) stops it from sending topology descriptions altogether; describe returnsNOT_STORED.- A broker without the plugin configured cleanly reports
NOT_STOREDon describe and never asks the client to push (the broker-side half of the rolling-upgrade matrix; the client-side half is intrinsic to wire-version negotiation). - Configure a short
offsets.retention.minutesandoffsets.retention.check.interval.ms, run a streams app that pushes its topology, stop it, wait for the offsets to expire and the cleanup timer to fire, and verifyplugin.deleteTopologywas called and the group was tombstoned. Run as a system test because the realistic timing is minutes-to-hours and overridingoffsets.retention.minuteslow enough at the integration-test layer would impact the shared embedded-cluster's offset semantics for unrelated tests.
Rejected Alternatives
Embedding the topology description in the heartbeat
...
Topologies:
Sub-topology: 0
Source: KSTREAM-SOURCE-0000000000 (topics: [orders])
--> KSTREAM-FILTER-0000000001
Processor: KSTREAM-FILTER-0000000001 (stores: [])
--> KSTREAM-SINK-0000000002
<-- KSTREAM-SOURCE-0000000000
Sink: KSTREAM-SINK-0000000002 (topic: valid-orders)
<-- KSTREAM-FILTER-0000000001
The corresponding UpdateStreamsGroupTopologyDescription StreamsGroupTopologyDescriptionUpdate request body, with the topology converted to the wire format, looks like this:
...

