Feature release. Headline: Kafka record headers, end-to-end - functions can finally read and write Kafka headers, a gap upstream Apache StateFun never closed.
Kafka record headers
Remote functions built with statefun-sdk-java can now:
- Read the headers of the Kafka record that invoked them via
Message#headers()- order and duplicate keys preserved, values decodable as raw bytes, UTF-8 text, typed primitives (valueAsInt()and friends), or any SDKType<T>. - Write headers on egress records through the
KafkaEgressMessagebuilder -withUtf8Header, rawbyte[]/Slice,Type<T>, and binary primitive shorthands (withHeader("retry-count", 10)sends a real binary int).
Design points worth knowing:
- Kafka-exact null semantics. Kafka distinguishes a null header value from an empty one; so do we. Null survives the full ingress → function → egress round-trip. Header operations never throw on production paths - null values are preserved, null keys degrade to empty, undecodable values read as
null. - Opt-in per topic. Ingress header forwarding is off by default. Enable it with
forwardHeadersat ingress level or per topic (per-topic wins). Topics that don't opt in never capture header bytes; header-less records cost nothing extra anywhere. - Additive protocol. New protobuf fields only - old SDKs work against the new runtime and vice versa. No lockstep upgrade, no savepoint impact.
- Function-to-function headers ride along for free (
MessageBuilderhas the same API), andMessageBuilder.fromMessagenow preserves headers when forwarding. - Testing toolkit: build header-carrying messages with
MessageBuilder, assert egress output with the newtesting.KafkaEgressCapture.
Docs: Kafka record headers guide · design write-up
Also in this release
- Security: image CVE batch cleared - netty-bom 4.1.135.Final, jackson-bom 2.18.8, Flink 2.2.0 → 2.2.1 (flink-table-planner + base-image openssl CVEs), lz4-java convergence pin, completed logback migration.
- Flink Kubernetes Operator 1.11 → 1.15,
FlinkDeploymentCRs onflinkVersion: v2_2. - CI hardening: Trivy image scan on PRs and releases with published reports, weekly CVE-scan tracking issues.
- Dependency refresh across the board (AWS SDK BOM 2.49.1, JUnit BOM 6.1.2, Maven plugins, GitHub Actions).
Coordinates
<dependency>
<groupId>io.github.kzmlabs.flinkstatefun</groupId>
<artifactId>statefun-sdk-java</artifactId>
<version>3.4.0-KZM-3.4</version>
</dependency>docker pull ghcr.io/kzmlabs/flink-statefun:3.4.0-KZM-3.4
Full changelog: https://github.com/kzmlabs/flink-statefun/blob/release/CHANGELOG.md