Real-Time Cold-Chain Monitoring with Apache Flink, Exactly-Once Results and Zero-Loss Upgrades

Build a real-time cold-chain monitoring pipeline with Apache Flink: refrigerated trucks stream Avro readings into Kafka, a detector job raises alerts per shipment in event time with keyed state, timers and Flink CEP, a Flink SQL job computes per-minute statistics, and both reach ClickHouse exactly once through crashes, late data, schema changes, upgrades and rescaling, on kind and on Amazon EKS with checkpoints in Amazon S3.

Data Engineer. Advanced.

What you will build and explain

  • Explain event time, watermarks, idleness and alignment, and design a deterministic lateness policy that keeps late, out-of-order and duplicate readings from changing results, including after a restore.
  • Design Avro schemas with registry compatibility rules and evolve them without breaking producers or consumers.
  • Build stateful Flink jobs with keyed state, event-time timers, state TTL, side outputs, Flink CEP and Flink SQL windows.
  • Deliver results exactly once with checkpoints, Kafka transactions, read_committed consumers and idempotent ClickHouse tables, and prove it by crashing the jobs mid-stream.
  • Upgrade, roll back, rescale and change the state of running jobs with savepoints, operator UIDs and key groups.
  • Test streaming code with operator test harnesses, integration tests against real Kafka, Apicurio and ClickHouse, and a simulator whose expected results are known.
  • Run the pipeline with Strimzi and the Flink Kubernetes Operator on kind and on EKS with Pod Identity, diagnose it from checkpoints, watermarks, backpressure and lag, and remove every billable resource.

Before you begin

  • Reading and writing Java programs of a few hundred lines (classes, records, interfaces, generics, lambdas, exceptions) and building and testing them with Maven
  • SQL with SELECT, GROUP BY and joins; what a message broker, topic, producer and consumer are; running containers with Docker
  • Kubernetes Pods, Deployments, Services, Secrets and kubectl get, describe, logs and apply; for the optional EKS milestone, reading a short Terraform configuration and signing in to AWS with the CLI
  • A macOS or Linux computer with Docker and Bash, about 10 GB of memory and 20 GB of free disk for Docker; for the EKS milestone, the AWS CLI version 2, an AWS account where you may create VPC, EKS, IAM, S3 and ECR resources in one Region, 8 vCPUs of on-demand quota, and a spending limit

Who this is for

For data engineers who write Java and SQL, run Docker and use kubectl, and want to build stateful streaming pipelines whose results stay exact: event time and watermarks, keyed state and timers, Flink CEP and SQL windows, exactly-once delivery from Kafka to ClickHouse, and upgrades and rescaling through savepoints, on kind and on EKS.

Curriculum

Learning topics (20)
  1. Understand the brief and prepare your tools

    In this project you build a streaming pipeline with Apache Flink: two jobs that read sensor readings from Kafka, keep state per shipment, and write alerts and statistics that reach ClickHouse exactly once, even while you crash, upgrade and rescale them. You run it on a local kind cluster and, as an optional milestone, on Amazon EKS with checkpoints in Amazon S3.

  2. Follow a sensor reading from a truck to an alert and a dashboard

    This page explains the pipeline as a whole: what each part does, what moves between the parts, and why the design looks the way it does. The technology lessons go deeper into each tool, and the source guides go file by file; this page should make sense without either.

  3. Partitions, consumer groups, transactions and least privilege

    Kafka is where every reading enters the pipeline and every result leaves the jobs. The guarantees the rest of the project depends on start here: a shipment's readings arrive in order, two jobs read the same readings independently, results appear only when a job commits them, and each workload can touch only its own data.

  4. Changing a schema without breaking anyone

    Last quarter, a sensor firmware update added one field and broke Frostbourne's parser for a day. This lesson is about making that kind of change routine: every record carries a reference to the exact schema it was written with, a registry decides which changes are allowed, and readers built for the newest schema still read the oldest records.

  5. From a Java program to parallel tasks

    Before looking at what the detector computes, it helps to know what Flink does with the program you write: how a Java main method becomes tasks running on several machines, how records move between them, and where state lives. Every later lesson relies on these words: task, subtask, slot, parallelism, keyed stream, operator chain.

  6. Judging readings by when they happened

    The old nightly script counted readings in the minute they arrived. A truck leaving a dead zone uploads six minutes of buffered readings at once, and they all landed in one minute: the statistics were wrong, and an excursion inside the dead zone could vanish. This lesson is about judging every reading by when it happened, and about the hard part that follows: deciding when you've waited long enough for the readings of a moment, and what to do with those that come later still.

  7. Rules that remember and deadlines that fire

    A rule like "above 8 °C for more than 5 minutes" can't be decided from one reading. The detector has to remember, per shipment, when the excursion started and how warm it got, and it has to act when five minutes of event time have passed, even if no reading arrives at that exact moment. This lesson teaches Flink's keyed state and timers through the detector's three duration rules, its deduplication, and the alerts they produce.

  8. A sequence rule with Flink CEP

    The three rules of the previous lesson are about durations: something lasts too long. Release v2 adds a different kind of rule, a sequence: the door opens, and within four minutes the cargo is at least 3 °C warmer than when it opened. Opening the door on a hot loading dock is normal; the cargo warming fast afterwards is the warning sign. This lesson teaches Flink CEP, the library for rules like that, through the door-warming pattern.

  9. Per-minute statistics with a tumbling window

    The dashboards want, for each shipment and each minute, how many readings arrived, the lowest, highest and average temperature, and how many readings had the door open. That's a GROUP BY over time, and Flink can express it in SQL. This lesson teaches how Flink SQL runs over a stream, how window table functions group by event time, and how the metrics job mixes the DataStream API with SQL.

  10. Checkpoints, Kafka transactions and idempotent tables

    Last quarter's nightly job, rerun after a failure, counted the same excursions twice, and two disputed shipments couldn't be reproduced. The streaming pipeline must do better: every alert and every statistic reaches ClickHouse once, even when a TaskManager dies mid-stream, Kafka restarts or ClickHouse goes away for a minute. This lesson explains how three mechanisms combine to give that: Flink's checkpoints, Kafka transactions committed on those checkpoints, and output tables

  11. Kafka tables, materialized views and ReplacingMergeTree

    Alerts and statistics are useful only where people can query them: the operations team's dashboards, and auditors asking what happened to a shipment last Tuesday. Here that's ClickHouse, which reads the four output topics itself. This lesson explains how ClickHouse stores data, how its Kafka engine and materialized views turn a topic into rows, and how the tables are designed so a record delivered twice is stored once.

  12. Changing code, state and parallelism without losing anything

    The old nightly script couldn't be changed without losing its running counts. A streaming job has the same problem, only sharper: its state is the memory of every incident in progress. Stop it carelessly and the detector forgets that SHP-0003 has been above 8 °C for four minutes; start it from scratch and it re-reads a week of readings. This lesson teaches how Flink carries state across a code change or a change of parallelism, through the two drills that exercise it.

  13. Strimzi and the Flink Kubernetes Operator

    Kafka and Flink are stateful, distributed systems with their own ideas of membership, storage and upgrades. Running them with plain Deployments would leave you to script every step: create the broker before the topics, take a savepoint before replacing a job's pods, restore from it afterwards. This project hands those steps to two operators, Strimzi for Kafka and the Flink Kubernetes Operator for the jobs, and this lesson explains what they do, how they're installed, and how

  14. Five layers, each against known results

    A streaming job is hard to test for the same reasons it's hard to write: results depend on time, on arrival order, on failures, and on several systems agreeing. "It ran and produced something" proves little. This project tests at five layers, each against results known in advance, and this lesson explains what each layer can and can't catch, and the simulator and oracle that make exact expectations possible.

  15. The same pipeline on AWS without access keys

    The kind lab runs everything on your computer. On AWS, the same platform and job manifests run on Amazon EKS, with three things replaced: Flink's checkpoints go to Amazon S3 instead of SeaweedFS, Kafka's and ClickHouse's volumes are Amazon EBS volumes, and images come from Amazon ECR. This lesson explains each replacement, the identity design that keeps access keys out of the cluster, and the Terraform that builds it. The deployment guide is where you run it; this lesson only

  16. Signals, diagnosis and day-two tasks

    A pipeline that's correct on day one still needs someone to notice when results stop, slow down or look wrong, and to find out why. This lesson gathers the signals the pipeline exposes, explains what each means and what normal looks like, and gives a method for going from a symptom to a cause. It also covers the routine changes of day two.

  17. Run the pipeline on kind, then on EKS

    This guide takes you from the downloaded source to the pipeline running in two places. First a local kind cluster, which costs nothing: you deploy Kafka, the schema registry, ClickHouse and both Flink jobs, run a scenario whose correct results are known in advance, and then crash, upgrade and rescale the jobs while they run. Then, as an optional milestone, the same manifests on a small Amazon EKS cluster with checkpoints in Amazon S3. The cleanup guide removes both again.

  18. Troubleshoot the pipeline from its own evidence

    Most problems in this pipeline show up as one of three things: something doesn't start, results stop arriving, or results arrive but differ from what they should be. Each points to a different part of the evidence. The first useful question is always: at which stage of the data path does the evidence stop looking normal? Readings in Kafka, the jobs' progress, committed outputs, ClickHouse's consumers: the first abnormal stage is where to dig.

  19. Explain the pipeline's decisions in an interview

    An interview about this project rarely asks "what does the code do?". It asks why you chose this design over the obvious alternatives, and what happens when something fails. The question bank has twenty questions in five areas: architecture, time and state, exactly-once and schemas, operations and upgrades, and platform, security and testing. Each has a model answer, the talking points an interviewer listens for, and follow-ups that change a constraint.

  20. Remove everything and check for leftovers

    This guide removes what the deployment guide created: first the AWS resources of the EKS milestone, which cost money every hour they exist, then the local kind lab. Each part works from any partial state, so use it whenever you stop, even if a deployment step failed halfway.

Practical build steps (10)
  1. Build the toolbox and run the checks

    Before any cluster exists, you build the container that holds every tool and run the tests that guard every change to the jobs. Nothing in this milestone costs money or needs an AWS account.

  2. Create the kind cluster and load the images

    You create the local Kubernetes cluster the lab runs in, install the two operators that will run Kafka and Flink for you, and put the job images where the cluster can start them. At the end the cluster is ready but the coldchain namespace is still empty.

  3. Deploy Kafka, the registry, ClickHouse and both jobs

    You deploy the whole pipeline into the coldchain namespace in dependency order: secrets, Kafka with its topics and users, the schema registry, ClickHouse with its tables, the checkpoint store, then the two Flink jobs.

  4. Run a scenario and read the verifier's report

    You send 40 minutes of simulated truck readings through the pipeline and check every result against answers computed in advance. This is the moment the pipeline proves itself: not "it ran", but "it produced exactly these alerts and windows, once each".

  5. Crash, upgrade and rescale the running jobs

    You break things on purpose while a scenario runs: kill TaskManagers and ClickHouse, upgrade the detector to a release with new state and a new rule, and change its parallelism. After each, the verifier must pass exactly as before.

  6. Prepare AWS access, quota and inputs

    Before anything billable exists, you make sure the EKS milestone can finish and be removed: a sign-in that works inside the toolbox, permission to create and delete the resources, enough vCPU quota for the nodes, and the inputs the scripts read.

  7. Create the VPC, EKS cluster, bucket and registries

    You create the AWS side of the milestone with two Terraform roots: first the bucket that holds Terraform's state, then everything else in one apply. Your account is billed from here until the cleanup finishes.

  8. Publish the images, install and verify on EKS

    You build the images for the nodes' Arm processors, push them to ECR, install the operators and deploy the same manifests as on kind, with the EKS overlays. Then you run the small scenario on EKS and check where the checkpoints went and how the jobs got their credentials.

  9. Destroy the AWS resources and check for leftovers

    You remove everything the EKS milestone created, in an order that leaves nothing billable behind, and confirm it with a check that reads the account directly.

  10. Remove the local lab

    You delete the kind cluster and everything in it, then the toolbox, Maven's cache, the base images and the files the scripts wrote, once you no longer need them.

Access

Learning Access: INR 199 plus 18% GST. Source Pack: INR 399 plus 18% GST. 90 days of online access. No auto-renewal.

Cloud costs and boundaries

AWS usage is separate from project access. The kind lab runs on your computer and costs nothing. The optional EKS milestone costs about USD 0.36 per hour in ap-south-1 at on-demand prices (an EKS control plane, two m7g.xlarge nodes, public IPv4 addresses and EBS storage, with S3 and ECR adding cents); a two-hour session costs well under USD 1. Charges continue until cleanup finishes. This is a learning reference, not a hosted lab or a production-readiness guarantee.

Licence and completion

Vectametric Project Source Licence (2026-09-27): lawfully obtained source may be copied, modified and deployed for personal learning and interview preparation, including personal portfolio demonstrations with attribution. These permissions continue after online access expires. Do not resell or redistribute the Source Pack or its original source files, unchanged or modified. Commercial or client production use requires separate written permission. Third-party components downloaded when building or running the lab, such as the Maven dependencies in the pom.xml files, Apache Flink and its connectors, Apache Kafka, Strimzi, the Flink Kubernetes Operator, Apicurio Registry, ClickHouse, SeaweedFS, kind, kubectl, Helm, Terraform and its AWS provider, and the AWS CLI, retain their own licences. See LICENSE.txt and the Project Source Licence section of the site Terms for the full rules.

Questions about projects

Do I need a cloud account?

You can read the project material without deploying it. Running a cloud build requires the accounts, permissions and tools listed in that project's prerequisites. Deployment runs in your environment, not in a hosted Vectametric lab.

Can I read the code with Learning Access?

Yes. Learning Access includes the online source-file browser and explanations. The Source Pack adds the downloadable reference repository where available. The project's licence governs use of the source.

Are cloud charges included?

No. Cloud and CI usage are separate. Read the project's cost notice, set a budget and stop deadline, and follow its destruction and leftover-resource checks.

Does the project include troubleshooting and interview preparation?

The project curriculum lists the available scenarios and interview topics. These focus on understanding the architecture and explaining decisions; they are not a promise of particular interview questions or a job.

How long can I use the project?

The project page and checkout show the online access period for your selected plan. Access does not auto-renew. Downloaded source remains subject to its licence; future releases are not automatically included.

Review the Terms and No-Refund Policy before confirming access. All sales are final; Vectametric does not offer refunds.

This website is operated by VECTAMETRIC EDTECH (OPC) PRIVATE LIMITED, operating as Vectametric.

Corporate Identity Number (CIN): U85499KA2026OPC229822. GSTIN: 29AAMCV8281D1ZS. Registered office: RS NO/38/2A/1 BASTAND, ROAD MAHANTESH NAGAR, Ramdurg, Ramdurg, Belgaum- 591123, Karnataka.

Queries and grievances: Prajval Honnungar, Grievance Officer and Data Protection Contact.

Telephone: +91 94800 09310. Support: support@vectametric.com. Grievances: support@vectametric.com.

Copyright 2026 VECTAMETRIC EDTECH (OPC) PRIVATE LIMITED. All rights reserved.

Vectametric home · Roadmaps · Vecta IT Exams · Vecta Government Exams · Vecta Banking & Finance Exams · Vecta Entrance Exams · About us · Contact · Privacy Policy · Terms and Conditions · No-Refund Policy