Streaming · Open reference architecture
Streaming medallion
Kafka, Spark Structured Streaming and Apache Iceberg in Unity Catalog
Events in, governed tables out, seconds behind the source.
In one paragraph
A streaming medallion architecture applies the bronze, silver and gold layout to event streams. Apache Kafka buffers events, an Apache Spark Structured Streaming query appends them to a bronze Apache Iceberg table with its checkpoint on object storage, and a Spark Declarative Pipeline derives silver and gold. Because the tables are open and registered in Unity Catalog OSS, batch jobs, other engines and AI agents read the same data the stream writes.
Streaming
Kafka, Spark Structured Streaming and Apache Iceberg in Unity Catalog
Sources
Ingestion
Open lakehouse platform
Engine access
How agents, apps and people reach compute: a client session per identity.
Execution
Spark's execution modes, plus engines that read the same tables.
Data foundation
Open tables in a governed catalog, on storage you own.
Serving
Teams
When to use it
- Sources emit events continuously and consumers want tables, not topics.
- Latency of seconds to minutes is enough.
- You want one copy of history that streaming jobs, batch jobs and agents all read.
When to pick something else
- Request-path latency in milliseconds: see the real-time streaming architecture.
Walkthrough
How data moves through it
- 1
Buffer events
Producers write JSON events to a Kafka topic, including resends and late events.
- 2
Append to bronze
A Structured Streaming query reads Kafka and appends to a bronze Iceberg table; its checkpoint makes the write exactly-once.
- 3
Clean and deduplicate
Silver handles late and repeated events deterministically.
- 4
Aggregate
Gold computes the aggregates consumers read.
- 5
Compact
Streaming writes many small files; a scheduled rewrite_data_files keeps reads fast.
Bill of materials
Components and versions
| Capability | Component | Role in this architecture | Version | License |
|---|---|---|---|---|
| SourcesSource systems | Applications, devices and CDC | Emit events | ||
| IngestionEvent streaming | Apache Kafka | Durable event buffer (the orders topic) | Confluent 7.5.0 images | Apache-2.0 |
| IngestionChange data capture | Debezium | Turns database changes into Kafka events | Apache-2.0 | |
| Engine accessSpark Connect sessions | Spark Connect | The streaming query runs over Spark Connect | 4.3.0 | Apache-2.0 |
| ExecutionDeclarative pipelines | Spark Declarative Pipelines | Silver and gold derived from bronze | 4.3.0 | Apache-2.0 |
| ExecutionStructured Streaming | Apache Sparkor Apache Flink | Kafka to iceberg.bronze.orders_raw, checkpoint at s3a://lakehouse/_checkpoints | 4.3.0 | Apache-2.0 |
| Data foundationCatalog and credentials | Unity Catalog OSSor Apache Polaris, Lakekeeper | Iceberg REST catalog for every layer | 0.7.0 | Apache-2.0 |
| Data foundationOpen table format | Apache Icebergor Delta Lake, Apache Hudi | Bronze, silver and gold tables | Apache-2.0 | |
| Data foundationObject storage | SeaweedFSor RustFS, MinIO, Amazon S3 | Tables and streaming checkpoints | 4.51 | Apache-2.0 |
| OperationsOrchestration | Apache Airflow | Runs the batch side and table maintenance | 3.3.2 | Apache-2.0 |
| OperationsTable maintenance | Iceberg maintenance procedures | Compaction keeps small streaming files in check | Apache-2.0 |
People and agents
Who works with it
Data engineers
Pipelines that are correct, idempotent and cheap to rerun.
Works with: Event streaming, Change data capture, Declarative pipelines, Structured Streaming, Orchestration, Table maintenance, Open table format
AI agents
Tools with clear arguments, a sandbox to write into, fast feedback from dry runs, and version-pinned context.
Works with: Spark Connect sessions, Declarative pipelines
Platform engineers
A platform that is boring to run: deployable from code, observable, with identities for every person, service and agent.
Works with: Object storage, Catalog and credentials, Spark Connect sessions
Governance and security
Policies that hold in every engine and for every agent, lineage for audits, and least privilege by default.
Works with: Catalog and credentials
Run it
Reference code
Chapter 9 streams Kafka into iceberg.bronze.orders_raw over Spark Connect; chapter 8 builds silver and gold; chapter 10 adds maintenance.
The same flow writing Delta Lake bronze into Unity Catalog 0.6.0.
git clone https://github.com/open-lakehouse/open-lakehouse
cd open-lakehouse
cp .env.example .env # fill in POSTGRES_*, S3_* placeholders
./lakehouse setup # validate env, install deps, download ~860MB of JARs
./lakehouse start all # Spark 4.1 master + worker + Connect server + Kafka
./lakehouse start unity-catalog
./lakehouse start mlflow
./lakehouse status --json # confirm healthy (incl. spark.connect_grpc_listening)Caveats from the reference repos
- Match the Kafka connector to your Spark version exactly; a spark-sql-kafka build for one Spark minor version can fail with NoSuchMethodError on another.
- Kafka itself is not registered in the catalog; only the tables are.
Industry lenses
Where this architecture shows up
Each card opens the board with that industry's sources. Full industry pages: Payments and fintech, Manufacturing, Retail and e-commerce, Telecommunications, Cybersecurity.
Answers
Frequently asked questions
- How do I stream Kafka into Apache Iceberg with open source tools?
- Run an Apache Spark Structured Streaming query with the Kafka source and an Iceberg table as the sink, with its checkpoint on object storage, and register the table in an Iceberg REST catalog such as Unity Catalog OSS 0.7 so other engines can read it.
- Is the Kafka to Iceberg write exactly-once?
- Yes for the table: Structured Streaming records Kafka offsets in its checkpoint and commits each micro-batch atomically, so a restarted query neither skips nor duplicates batches.
Related architectures
All architecturesPlatform
The open lakehouse on a laptop
Spark 4.3, Apache Iceberg, Unity Catalog, Kafka, Airflow, MLflow and an agent, in Docker
Platform
The agentic lakehouse
Omnigent and MLflow over sandboxed Spark Connect sessions, on Iceberg and Unity Catalog
Batch
Batch medallion with Spark Declarative Pipelines
Spark 4.3, Apache Iceberg and Unity Catalog with bronze, silver and gold
