Skip to content

Examples

Two end-to-end walkthroughs showing how the actor model, durable state, and ingress/egress fit together for non-trivial systems.

Pick whichever is closer to what you're building:

  •   Real-time fraud detection


    Per-card risk scoring on a payments stream. Velocity checks, geo-impossibility detection, delayed re-evaluation. Shows actors that decay state over time and emit alerts only on threshold breach.

  •   IoT fleet digital twins


    Per-device twins for industrial telemetry. Rolling sensor stats, battery degradation alerts, command/response loop. Shows long-lived actors, command emission back to devices, and offline-detection via timers.

What both examples have in common

  • One actor per logical id — one card, one device. Per-instance state, isolated by Flink's keyed-state.
  • Durable state survives restart — RocksDB + S3 checkpoints; if the cluster failovers, state is recovered.
  • Exactly-once messaging — Kafka transactions + Flink checkpointing; no duplicate alerts on replay.
  • Polyglot remote functions — the function logic is Java in these examples but could be Python, Go, or JS over the same HTTP wire protocol.

What you'll see in each example

  1. Problem framing — the concrete business signal each system has to detect
  2. Architecture diagram — Mermaid flow of the pipeline
  3. Protobuf message types — wire format
  4. StatefulFunction implementation — Java with annotations explaining each step
  5. module.yaml wiring — ingress, egress, function endpoint
  6. Local testing — how to send a synthetic event and verify the response
  7. Production scaling notes — partitioning, hot-key handling, throughput targets

Next steps