Implementation:Apache Kafka CoordinatorRuntime OnMetadataUpdate
Appearance
| Knowledge Sources | |
|---|---|
| Domains | Distributed_Systems, Metadata_Management |
| Last Updated | 2026-02-09 12:00 GMT |
Overview
Concrete tool for propagating cluster metadata updates to coordinators provided by the CoordinatorRuntime.
Description
The onMetadataUpdate method updates the global metadataImage and schedules an internal event for each registered coordinator partition. Each event checks the coordinator's state and, if ACTIVE, calls coordinator.onMetadataUpdate(delta, newImage) to deliver the metadata change.
Usage
Called by the Kafka broker's metadata listener when it receives new metadata from the KRaft controller.
Code Reference
Source Location
- Repository: Apache Kafka
- File: coordinator-common/src/main/java/org/apache/kafka/coordinator/common/runtime/CoordinatorRuntime.java
- Lines: L2368-2410
Signature
public void onMetadataUpdate(
CoordinatorMetadataDelta delta,
CoordinatorMetadataImage newImage
)
Import
import org.apache.kafka.coordinator.common.runtime.CoordinatorRuntime;
import org.apache.kafka.coordinator.common.runtime.CoordinatorMetadataDelta;
import org.apache.kafka.coordinator.common.runtime.CoordinatorMetadataImage;
I/O Contract
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
| delta | CoordinatorMetadataDelta | Yes | The metadata changes |
| newImage | CoordinatorMetadataImage | Yes | The new complete metadata image |
Outputs
| Name | Type | Description |
|---|---|---|
| void | Global metadataImage updated; each ACTIVE coordinator notified |
Usage Examples
// Called by broker metadata listener
coordinatorRuntime.onMetadataUpdate(metadataDelta, newMetadataImage);
Related Pages
Implements Principle
Page Connections
Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment