GlobalKTable broadcasts a complete update stream to every Kafka Streams application instance. Unlike a partitioned KTable, each instance stores every record from the source topic, making the table useful for reference data and stream enrichment. section 8.0 section 8.5
Use a GlobalKTable when the application needs to:
- Broadcast reasonably static information, such as user or sensor metadata, to every instance. section 8.5 section 8.6.3
- Join a KStream without co-partitioning, even when the stream key is null or does not match the table key. section 8.6 section 8.6.3
- Materialize the complete source topic locally in a KeyValueStore; the source topic provides recovery data instead of a generated changelog topic. section 8.5
Enriching unkeyed sensor events
Create the table with builder.globalTable("sensor-info", ...), then join sensor readings by extracting the sensor ID from each event: sensorKStream.join(sensorInfoGlobalKTable, (key, sensor) -> sensor.getId(), (sensor, info) -> formatReading(sensor, info)). The result retains the stream key, even when that key is null; a separate thread updates the GlobalKTable outside normal record processing.
Figure 8.13 GlobalKTable contains all records in a topic on each application instance.
Compare partitioned KTable ownership with the full GlobalKTable copy held by every application instance. section 8.5

