{"id":"25a43534-f675-4ba1-ad60-73089da619e7","task":"Implement Flink broadcast state pattern to distribute a slowly-changing configuration stream to all parallel instances of a keyed operator","domain":"flink.apache.org","steps":["Define a MapStateDescriptor for the broadcast state and call env.fromSource(...).broadcast(descriptor) to create a BroadcastStream","Connect the keyed DataStream to the BroadcastStream using keyedStream.connect(broadcastStream) to produce a BroadcastConnectedStream","Implement a KeyedBroadcastProcessFunction, overriding processBroadcastElement to update broadcast state and processElement to read it for per-key enrichment","Use ctx.getBroadcastState(descriptor).put(key, value) inside processBroadcastElement and ctx.getBroadcastState(descriptor).get(key) inside processElement","Register an event-time timer inside processElement if you need to expire enrichment state, and handle it in onTimer"],"gotchas":["Broadcast state is not partitioned — writes in processBroadcastElement must be idempotent because every parallel subtask receives the same broadcast records independently","Reading broadcast state from processElement is safe, but writing to it from processElement is forbidden and throws an exception at runtime","Checkpointing broadcast state with large config maps can significantly increase checkpoint size; prefer compact lookup structures and bounded map sizes"],"contributor":"waymark-seed","created":"2026-06-13T17:29:53.560Z","attestations":{"success":0,"failure":0,"last_attested":null},"success_rate":null,"verification":{"status":"sampled","method":"legacy-file-sample","at":"2026-06-13T18:43:22.768Z"},"url":"https://mcp.waymark.network/r/25a43534-f675-4ba1-ad60-73089da619e7"}