Skip to main content
Stream Processing and Analytics

Kafka Streaming Demo and a High-Level View of Spark

Published: 2026-08-07
Level: postgraduate
Audience: Postgraduate students in Stream Processing and Analytics

Prerequisite Knowledge

This lecture builds on the following concepts from earlier lectures. If any feel unfamiliar, review the linked notes before proceeding.

Previously Covered in This Subject

  • Kafka topics, partitions, and offsets — covered in Lecture 7 (Kafka Architecture) and Lecture 8 (Kafka Partition Estimation)
  • ZooKeeper coordination for the cluster — covered in Lecture 5 (ZooKeeper: Configuration and Coordination)
  • Starting a Kafka cluster — covered in Lecture 7 (Setting Up and Running Kafka)
  • Stream processing versus batch processing — covered in Lectures 1 and 4
  • Spark as a processing framework — covered in Lecture 3 (Processing Frameworks)
  • Message delivery semantics — covered in Lecture 6 (Message Delivery Semantics)

This lecture runs the Kafka producer–consumer console demo end to end — architecture recap, live walkthrough, and the Windows environment setup that makes it run — then steps back for a high-level view of Spark: what it is, how its layers fit together, and the programming models it offers.

9.1 Course Roadmap and Assessment Plan

9.1.1 The Four Remaining Modules

Half of the course is over, and everything that remains is about streaming frameworks. Four topics are left on the schedule: Kafka streaming, Kafka–Spark integration, Spark streaming, and streaming algorithms. Notice what the list says about the course's shape: the first half built the foundations of distributed batch processing, and the second half is devoted to moving data continuously instead of in fixed batches.

The instructor plans to give Kafka–Spark integration two to three classes, and three in practice, because that is where the two big frameworks meet — Kafka is the message pipeline that feeds events in, and Spark is the processing engine that consumes them. The remaining classes will focus predominantly on Spark streaming, on Kafka–Spark integration, and then on some streaming algorithms.

9.1.2 The Timeline

The course ends on May 12. This month (March) has two more classes. April has four classes on the 7th, 14th, 21st, and 28th, and May has two classes. Around eight classes remain in total, including one session the instructor missed and needs to compensate with an extra class, so after today's class seven classes remain.

There is no regular class next week, because the makeup exam falls in that slot.

Why the roadmap matters before the content: this is the last administrative lecture. From here on, every class is technical and builds on the one before it — the demo you see today is the exact setup you will need for the Spark examples that start next class. The instructor is laying out the calendar now so that a missed week does not silently eat into the remaining material.

9.1.3 Assessments and Exam Guidance

Both assignments are already published — assignment one and assignment two — and the plan for the second quiz depends on finishing one more piece of content first. The instructor wants the introduction to Flink streaming completed before taking up that quiz. Apache Flink is a real stream-processing engine (a sibling of Spark Streaming with native support for event-time windows and exactly-once state), so the module name resolves cleanly to Flink. After that, the instructor will show how to create an account on the Databricks platform so the assignment problems can be solved there. The quiz is planned for around the first week of May.

Exam note: the mid-semester makeup exam is next week, and one student has to sit for it on Sunday because they were unavailable earlier. A few students found the exam question about consumers and producers confusing, while the other two questions were manageable — that question is a signal to review Kafka producer and consumer concepts carefully. On the assignments, the submission link is a single link for both parts, and the instructor's advice is direct: complete part one by the end of this month, because otherwise part one and part two will both get started at the same time. That delay is not a personal failing — it is a general human tendency — but the instructor wanted to say it up front so students know what is coming.

9.1.4 Student Questions and Answers

Q: Was the second assignment shared? I cannot see it in the e-portal. A: Both assignments were shared together. The part B handout counts as the second assignment.

Q: In our group only two members are active and the others are not responding. Is it okay if the two of us do it together? A: Yes. But drop a mail with those other members in CC, because otherwise they may suddenly emerge later and expect credit.

Q: The question related to consumers and producers in the exam was really confusing and I could not answer it. A: No problem. The remaining two questions you were able to do, right? That should be fine.

9.2 Kafka Streaming: Architecture Recap and Live Demo

9.2.1 The Core Building Blocks

Hook: you type a few words in one window and the same words appear in another window on the same machine. What has to happen in between for that text to travel, be stored, and be picked up again? That small exchange is the whole story of Kafka.

The Kafka architecture rests on three moving parts: the Kafka broker, the Kafka producer, and the Kafka consumer. Producers and consumers can be of any type — the producer is whatever writes events, the consumer is whatever reads them, and the broker sits between them and stores what passes through. You can think of the broker as the shared mailbox: the producer drops letters in, the mailbox holds them, and the consumer comes to collect. The producer never hands the letter directly to the consumer, which is what lets them be started, stopped, and scaled independently.

Three earlier concepts complete the picture: the Kafka topic, the Kafka partition, and the Kafka offset.

The six building blocks, defined:

  • Broker — the Kafka server that stores messages and serves them to consumers. A Kafka cluster is one or more brokers.
  • Producer — any program that writes events (a sensor, a web server, a Python script). Whatever writes events.
  • Consumer — any program that reads events. Whatever reads them.
  • Topic — the named channel that messages are written to and read from (like the labeled mailbox or the named email folder).
  • Partition — the unit of parallelism inside a topic. A topic can be split across several partitions, and partitions can live on different brokers, which is how Kafka scales to millions of messages per second.
  • Offset — the position of a message within a partition. Offsets are numbers assigned in order (0, 1, 2, ...) as messages are appended, and a consumer uses its offset to track how far it has read.

The last piece is what gives Kafka its superpower: because each partition is an append-only log, any consumer can rewind to an older offset and replay the stream from that point. In the queue design most beginners imagine, a message is deleted the moment one consumer reads it. Kafka instead keeps messages around (for a retention window such as 12 hours or 50 GB), and each consumer tracks its own position. That means many consumers can read the same topic independently, each at its own pace, and a failed job can re-read exactly the events it missed instead of losing them forever.

Assumption and scope. This design assumes messages are append-only and never edited once written — the broker only ever adds to a partition. If a system needs to modify already-stored events in place, Kafka is the wrong tool. Also, ordering is guaranteed within a partition only; Kafka makes no ordering promise across different partitions of the same topic.

Pitfalls. A common beginner trap is to believe that deleting a message from one consumer's read deletes it for everyone — it does not; each consumer group tracks its own offset. Another is to think the offset is global across the topic; it is local to a partition, so two partitions each restart their numbering at 0. And a third: reading "from the beginning" (offset 0) replays every retained message, which can flood a consumer that expects only new arrivals.

9.2.2 Worked Walkthrough: The Producer–Consumer Demo

This demo was postponed from the previous class, because that class was spent on the sample paper. Today it runs end to end. The full sequence needs Zookeeper, then the Kafka broker, then a topic, then a producer and a consumer, and the commands come from the Kafka documentation — the instructor's standing advice is that none of these commands need to be memorized; copy them from the documentation.

zookeeper-server-start.bat C:\streaming\confluent\etc\kafka\zookeeper.properties
kafka-server-start.bat C:\streaming\confluent\etc\kafka\server.properties
kafka-topics.bat --create --topic example_event --bootstrap-server localhost:9092
kafka-console-producer.bat --broker-list localhost:9092 --topic example_event
kafka-console-consumer.bat --topic example_event --from-beginning

Purpose. The console demo proves, in under a minute, that a Kafka cluster is alive and that producers and consumers can actually exchange messages. It is the smoke test you run before wiring Kafka into real applications.

Inputs and outputs. The input is a running Zookeeper service plus a running broker; the output is a topic named example_event on broker localhost:9092, with one console window producing lines of text and another consuming them.

Step 1 — start Zookeeper. In a command window, run zookeeper-server-start.bat with the complete path to zookeeper.properties. The shell initially failed to recognize the properties file, and the fix was to give the entire path instead of a partial one. Once the file loads, Zookeeper is up. Zookeeper is the coordination service the Kafka cluster depends on — it keeps track of which brokers are alive and which partitions each consumer should read — and it must run first. This is the reason the demo script order is not arbitrary: the broker registers itself with Zookeeper, and consumers read their assignment from Zookeeper, so nothing works until Zookeeper is up.

Step 2 — start the Kafka broker. In a second command window, run kafka-server-start.bat with the full path to server.properties. The broker starts, and the console reports that the Kafka server with id 0 has started. That "id 0" is the broker's identity inside the cluster; a production cluster runs several brokers with distinct ids.

Step 3 — create the topic. Run kafka-topics.bat --create and give the topic a name; instead of the default quickstart name, the topic here is example_event. The flags follow the standard create-topic form, with --bootstrap-server localhost:9092 telling the command which broker to contact. Without the topic, the producer and consumer would have nothing named to attach to.

Step 4 — start the producer. Run kafka-console-producer.bat pointing at the topic. Here the class watched a live error correction: the instructor first typed the flag used for the consumer, then caught the mistake — for the console producer the flag is --broker-list, not --bootstrap-server. Once the correct flag was in place, the producer showed its greater-than prompt (>), which means it is ready to accept input.

Live error correction: the producer's connection flag is --broker-list, the consumer's is not. The console producer was originally given --bootstrap-server — the flag the console consumer uses — and the producer did not become ready until the flag was corrected to --broker-list localhost:9092. This is the classic producer/consumer flag mix-up the professor showed live: the broker list names the servers that hold the partitions, while the bootstrap server is the contact address used at startup. When a console tool hangs without showing its prompt, check the flag name before anything else.

Step 5 — start the consumer. In another window, run kafka-console-consumer.bat for the same topic. To see messages that were sent before the consumer started, add the --from-beginning flag, which tells the consumer to read from offset 0 rather than from the newest message onward. The standard console consumer follows exactly this form: the topic name plus the begin-from flag when you want the full history.

Step 6 — send messages. Everything typed in the producer window flows to the consumer window: the instructor typed "Hello" and then "Hello Kafka", and both appeared on the consumer side. That is the whole mechanism in miniature — the producer writes messages to the topic, the broker holds them, and the consumer reads them off.

Worked trace — the demo on real inputs.

  1. Zookeeper starts and reports the properties file loaded.
  2. kafka-server-start.bat starts broker id 0 on localhost:9092.
  3. kafka-topics.bat --create --topic example_event --bootstrap-server localhost:9092 creates the topic.
  4. kafka-console-producer.bat --broker-list localhost:9092 --topic example_event shows the > prompt.
  5. kafka-console-consumer.bat --topic example_event --from-beginning waits in the consumer window.
  6. Producer input Hello → consumer window prints Hello.
  7. Producer input Hello Kafka → consumer window prints Hello Kafka.

Result: each line typed at the producer prompt appears verbatim in the consumer window, in the same order. Sense-check: the consumer received exactly the two messages that were sent, in the order they were sent — nothing was dropped, nothing was reordered, because both messages landed in the same partition and were consumed in offset order.

Real-world: Confluent offers a free version of Kafka, and the same console commands shown here are the quickest way to prove a Kafka cluster is alive before wiring it to real applications. Production teams use the identical five-step sequence — Zookeeper, broker, topic, producer, consumer — as the sanity check after a fresh install.

9.2.3 The Demo Environment: Confluent Folder Layout

The layout of a Confluent Kafka installation explains where every command and configuration file lives. In the installation folder there is a bin folder, and inside it a windows subfolder holding Windows-compatible batch files — the .bat files used above. That is why the PATH entry points into confluent\bin\windows: the command-line tools themselves are the batch files in that subfolder.

The properties files sit elsewhere: in Confluent Kafka they live in the etc folder, under etc\kafka, which holds zookeeper.properties, server.properties, and the producer and consumer properties files. If you use plain Apache Kafka instead of Confluent, the same properties files are under a config folder instead. The layout difference is only a folder name — etc\kafka in Confluent versus config in vanilla Apache Kafka — and every demo command needs the full path to its properties file, whichever distribution you use.

Pitfall: a command that "cannot find" or "does not recognize" a properties file is almost always being given a partial path. The instructor's rule when a file is not recognized: type the entire path. zookeeper-server-start.bat zookeeper.properties fails; zookeeper-server-start.bat C:\streaming\confluent\etc\kafka\zookeeper.properties works.

9.2.4 Worked Walkthrough: Windows Installation and Environment Setup

The setup was shown live, and the instructor shared a text document with the installation steps for both Kafka and Spark. The order matters, and each step is an environment variable or a PATH entry.

Purpose. This procedure turns a fresh Windows machine into a machine that can run Kafka and Spark locally, free of charge. Everything you need is an environment variable telling the tools where their components live.

Inputs and outputs. Inputs: a JDK install, a Spark download, the Hadoop Win Utilities zip, a Confluent Kafka download, and Python (or Anaconda). Outputs: JAVA_HOME, HADOOP_HOME, KAFKA_HOME, SPARK_HOME, and PYSPARK_PYTHON all set, with the bin folders added to PATH.

  1. Install Java, then create the JAVA_HOME environment variable pointing at the JDK folder. This was shown in the environment variables dialog, with JAVA_HOME attached to the installed JDK directory. Kafka and Spark are both JVM software, so this variable is the foundation everything else builds on.
  2. Download Spark — the Spark download bundles Hadoop's file system — and separately download the Hadoop Win Utilities, commonly called winutils. Compatibility is the key word: for Spark 3.0.0 the compatible winutils version is 2.7.7. Download the zip, keep only the Hadoop version compatible with your Spark, unzip it into a folder like C:\streaming\hadoop, create HADOOP_HOME pointing there, and add it to the PATH.
  3. Kafka: create KAFKA_HOME pointing at the Confluent Kafka installation folder, then add the bin folder — specifically confluent\bin\windows — to the PATH.
  4. Spark: download Spark, create SPARK_HOME, and add the spark\bin folder to the PATH.
  5. PySpark needs Python, since PySpark is the Python flavor of Spark. Install Python with python.exe, or use the Anaconda Python that comes with Anaconda 3. Create the PYSPARK_PYTHON environment variable and point it at the Anaconda Python executable (for example the python.exe inside the Anaconda 3 folder). Then link the Spark 3 Python folder, and add the unit testing library (py4j) that PySpark needs, into the same configuration.

Worked trace — what each environment variable points at.

Variable Points at Purpose
JAVA_HOME the JDK install folder gives Kafka and Spark their runtime
HADOOP_HOME C:\streaming\hadoop (winutils 2.7.7 for Spark 3.0.0) gives Spark's bundled Hadoop filesystem Windows-native binaries
KAFKA_HOME the Confluent Kafka folder lets kafka-*.bat find its distribution
SPARK_HOME the Spark folder lets spark-shell, pyspark find the engine
PYSPARK_PYTHON Anaconda's python.exe tells Spark which Python interpreter to use
PATH additions confluent\bin\windows, spark\bin lets you type the command names from any folder

Sense-check: after this setup, opening a fresh terminal and typing kafka-topics.bat or pyspark runs the tool from any working directory — if a command is still "not recognized", the missing piece is a PATH entry, and the fix is the full folder path.

Pitfalls. Version mismatch is the first failure mode: winutils 2.7.7 belongs with Spark 3.0.0, and pairing an arbitrary winutils with a Spark version it was not built for throws filesystem errors at runtime. The second is pointing PYSPARK_PYTHON at the wrong interpreter — if Anaconda is installed but PYSPARK_PYTHON still names a bare python, Spark may use the wrong Python and fail to import its own modules. The third is skipping the PATH steps: tools work only from the folder where the .bat lives until their bin folders are on the PATH.

Real-world: this local Windows setup is the free path to PySpark, and it is exactly what the Databricks platform provides as a managed service for the assignment. The winutils step exists because Hadoop's file system code, which Spark bundles, needs Windows-native binaries on this platform — on Linux and macOS that code runs without any extra download, which is why the winutils step appears only in Windows guides.

9.2.5 Student Questions and Answers

Q: Sir, does Kafka have a free version? A: Yes. The instructor shares the free version of Confluent Kafka, along with a documentation link that helps set up the producer and consumer demo from start to finish.

Q: If we do everything programmatically, can we avoid running these scripts? A: No, you will not be able to avoid them, and that is a drawback of the whole thing. Even when you do it programmatically — for example, integrating the events coming from Kafka and sending them to a Spark processing engine — you still need to specify who the producer is, who the consumer is, and all the details. In the Spark environment you configure "I am reading these messages from Kafka", but you still need to run these scripts. You cannot avoid setting up Zookeeper and everything around it. Sending messages from Python is possible, and only that sending and reading part can be done from code.

Q: Then why not write the whole thing in Python? A: The connection details still have to be set up and the services still have to run. That is why the instructor's advice stands: you do not have to remember these commands — copy them from the Kafka documentation and keep them somewhere.

9.3 Spark: A High-Level View

9.3.1 What Spark Is

Hook: in the batch world, every time a computation passes over your data, the data has to be read back from disk. What if a framework could simply leave the data in memory between passes — would that change which algorithms become practical? That single change is why Spark exists.

Spark is a processing engine that sits above the MapReduce techniques used conventionally. Whenever you think of Spark, think of in-memory computation. It is a very generic distributed data processing model — generic in the sense that the same engine handles batch processing, stream processing, and real-time processing. One engine, three workloads: that generality is what makes it the workhorse of modern data platforms.

Two capabilities make it special. First, it supports iterative algorithms, where the same computation passes over the data repeatedly and intermediate results stay in memory. This is the decisive difference from classic MapReduce: a MapReduce job that iterates must write its intermediate output to disk between passes, while Spark keeps the data cached in memory, so machine-learning algorithms that loop over the same dataset hundreds of times run dramatically faster. Second, it supports interactive querying: you can write queries on the streaming data the way you write SQL queries on a stationary data table. That is the uniqueness of Spark.

Recap: Spark = in-memory computation + a generic model for batch, stream, and real-time + iterative algorithms + interactive querying. The one sentence to remember: same engine, repeated passes over data held in memory, queries asked like SQL.

9.3.2 Spark Architecture: Cluster Managers, Spark Core, and High-Level APIs

The architecture block diagram builds from the bottom up. The bottom layer is the cluster manager, which can be Mesos, YARN, a standalone scheduler, or Kubernetes. The cluster manager's job is the resource negotiation: it decides which machines in the cluster get assigned to run which parts of a Spark program, and it hands over memory and CPU as the job asks for them.

On top of the cluster manager sits the Spark Core — the layer where the Spark program is written. Spark Core is the real, standard name of this layer: it is Spark's engine, the part that schedules tasks, moves data, and keeps the program alive across machine failures. The Spark Core program can be implemented in Python, Scala, or Java.

Spark Core's four responsibilities:

  • Task scheduling — breaking a computation into tasks and dispatching them across the cluster.
  • Memory management — deciding what is cached in memory and what spills to disk.
  • Fault tolerance — recovering work when a machine dies, without the user rewriting the program.
  • Data access — the interaction with storage systems (reading and writing HDFS, S3, Kafka, databases).

The cluster manager story repeats at a lower level: you can run Spark on YARN, on Mesos, on a simple standalone cluster manager, or on Kubernetes. In other words, Spark Core stays the same; only the resource negotiator underneath changes.

On top of the core sit the high-level APIs. One is the structured streaming API, which the instructor called very, very powerful, popular, and innovative. The other high-level pieces are real-time processing, Spark SQL, the Machine Learning Library (MLlib), and the Graph library (GraphX). These libraries sit above Spark Core and give you ready-made building blocks — SQL queries, machine-learning models, graph algorithms — instead of raw task-level programming. For the assignment, the class will use the Machine Learning Library.

The instructor's practical note: if you are good in Java, Python, or Scala, that is enough for stream processing — and this course uses Python, which means PySpark.

Real-world: managed Spark platforms such as Databricks provide the same architecture as a service, and Spark integrates with the Hadoop HDFS, with Kafka, and with AWS, so the architecture you learn here is the one used in production deployments.

9.3.3 Programming Models: RDD versus Structured Streaming

Spark programming can be done in two ways. One uses the RDD — the resilient distributed dataset — and the other uses the structured streaming API. The RDD is the old model and is obsolete as well; it is not popular now. The structured streaming API is the most commonly used model currently. The course looks at both: one or two RDD examples for familiarity, and structured streaming in much more detail.

RDD — the resilient distributed dataset. Resilient means fault-tolerant: the dataset is described as a lineage of operations, so any lost partition can be recomputed from its ancestors instead of being permanently lost. Distributed means the data is partitioned across the machines of the cluster. RDD was Spark's original programming model — the one that made the framework famous — but it exposed low-level details (partitions, transformations, actions) that beginners found hard, and modern Spark guides recommend the higher-level DataFrame and structured streaming APIs.

Structured streaming. The current model: you describe your computation as a query on an unbounded table, and Spark continuously executes it as new data arrives, producing results in mini-batches. It is what makes the "write queries on streaming data the way you write SQL on a static table" idea from 9.3.1 concrete.

Comparison — when to pick which.

Dimension RDD Structured streaming
Age original model (2009–2014 era) current, recommended model
Abstraction low-level: partitions, transformations, actions high-level: query on an unbounded table
Fault tolerance lineage recomputation checkpointing plus replayable sources (Kafka offsets)
Popularity obsolete, not popular now the commonly used model
Course coverage one or two examples for familiarity covered in much more detail

One-sentence rule: use RDD only to understand how Spark thinks; write new work in structured streaming.

9.3.4 Data Ingestion and the Machine Learning Library

Data ingestion into the Spark streaming environment can come through many platforms — Kafka, Kinesis, Twitter, and so on — and the Spark documentation shows these ingestion diagrams. The pattern is always the same: events arrive on a message platform, Spark reads them from it, and the streaming query processes them as they come. Because the sources are replayable (Kafka offsets, Kinesis position), Spark can re-read anything it missed after a crash.

On the machine learning side, MLlib covers the typical tasks: classification, regression, clustering, collaborative filtering, and more. The role of machine learning in PySpark is to analyze the events in real time and make predictions and labeling on these events. The instructor's example: when you are predicting the price of a particular vegetable, you need to look at every column of the data, and the next step is data cleaning — checking each column before it feeds the model.

Scope of MLlib in this course. MLlib is a library, not a framework: it runs inside the Spark engine you already saw, on top of data frames fed by streaming sources. For the assignment, the flow is: ingest events (Kafka or Kinesis) → load into Spark → run an MLlib task (classification, regression, clustering, or collaborative filtering) → write predictions back out. Students with no machine-learning background are not expected to know every task — the assignment focus is MLlib running on the Spark architecture, not ML theory.

Real-world: this is the production pattern behind real-time scoring — events arriving through Kafka or Kinesis are classified or labeled as they arrive, which is what companies mean when they say real-time prediction on streaming events.

9.3.5 Student Questions and Answers

Q: Are we going through both RDD and structured streaming in this course, or only RDD? A: We are going through both. RDD gets one or two examples, just so you see it, but structured streaming is covered in more detail.

Q: For me this is the first time learning machine learning — I have some theoretical awareness, but I have not practiced it. A: No problem. Resources will be provided and you can cover them in one day. In a fresher's case, you may not know all these tasks; the expectation for freshers is the Spark architecture and streaming.

Q: I have worked with machine learning — mostly classification, regression, and clustering — and I have used PySpark a little. Collaborative filtering I would have to look up. A: Then you are very familiar with this. That is no problem either. The resources are there for everyone, and for the assignment the focus is MLlib on the architecture you just saw.

9.4 What Comes Next

9.4.1 Before the Next Class

The next class starts Spark streaming with examples. Meanwhile, two things are expected. First, set up the local environment using the installation document that was shared — the next class assumes Kafka and Spark are installed. Second, complete part one of the assignment by the end of this month. The assignment has two parts and the submission link is one link for both, but part one should be ready even if the final submission happens together.

What to do before next class, in order:

  1. Run through the shared installation document until pyspark starts on your machine (Kafka and Spark must be installed before the examples).
  2. Finish part one of the assignment by the end of this month — regardless of when part two gets submitted.
  3. Install and try the PyCharm IDE, which the instructor mentioned as a comfortable place to run these scripts.

The sample scripts themselves will be explained when the Spark examples start, and OneNote-style notes will be uploaded along with the Spark examples.

9.4.2 Student Questions and Answers

Q: Considering the makeup exam as well, can the assignment be extended for a week? A: The assignment was given a long time back. At least part one should be completed — forget the extension. Why not complete part one by this month itself?

Q: The submission link is a single link for both assignments, so both should go in together? A: I understand. But at least make it ready. Otherwise you will start both at the same time, and that is a general human tendency — I am flagging it up front so you know what is in store.

Q: Please upload your OneNote as well, it will help us. A: Today was only installation. When the Spark examples are covered, that material will be uploaded. Today there is nothing great to upload yet.

Exam Guidance Summary

  • The mid-semester makeup exam is next week; there is no regular class in that slot, and one student sits the makeup on Sunday.
  • The second quiz is planned for around the first week of May, after the introduction to Flink streaming concepts is completed (Apache Flink, the stream-processing engine, resolves the earlier audio ambiguity).
  • The exam question about consumers and producers confused several students, while the other two questions were manageable — study Kafka producer and consumer concepts, and the console demo, before the makeup. In particular, remember which flag belongs to which console tool: the producer uses --broker-list, and the consumer reads from the beginning with --from-beginning.
  • Assignments one and two are both published with a single submission link; complete part one by the end of this month regardless.
  • Databricks account setup will be explained so the assignment problems can be solved on the platform.

Exam note: the highest-yield revision for the makeup exam is the Kafka building blocks and the producer–consumer console flow — the question most students found confusing was about exactly that. Be ready to name the six pieces (broker, producer, consumer, topic, partition, offset), state the start order (Zookeeper first, then broker, then topic, producer, consumer), and explain why the broker-list flag is needed on the producer.

Key Industry Applications

  • Real-world: Confluent Kafka's free distribution and console scripts for quick cluster verification — the same five-step console sequence (Zookeeper, broker, topic, producer, consumer) is the standard smoke test after any Kafka install.
  • Real-world: production ingestion into Spark streaming from Kafka, Kinesis, and Twitter — replayable sources let Spark re-read anything it missed after a failure.
  • Real-world: MLlib for real-time event analysis, prediction, and labeling — the pattern behind real-time scoring systems, where incoming events are classified or labeled as they arrive.
  • Real-world: Databricks as the managed platform for the assignment, mirroring local PySpark setup — the architecture you set up by hand on Windows is exactly what the managed service provides.
  • Real-world: local Windows PySpark requires Hadoop Win Utilities matched to the Spark version (winutils 2.7.7 for Spark 3.0.0), because Spark's bundled Hadoop file system code needs Windows-native binaries.
  • Real-world: Spark integrates with Hadoop HDFS, Kafka, and AWS in production deployments, and the in-memory architecture makes iterative machine-learning workloads practical at scale.

SPA Lecture 09 notes · Kafka Streaming Demo and a High-Level View of Spark

Stream Processing and Analytics· postgraduate· 2026-08-07

Sections Breakdown

19.1 Course Roadmap and Assessment Plan

Remaining streaming modules, the timeline to May 12, and the assignment and quiz plan.

29.2 Kafka Streaming: Architecture Recap and Live Demo

The six Kafka building blocks, the producer-consumer console demo with its flag corrections, the Confluent folder layout, and the Windows installation and environment setup.

39.3 Spark: A High-Level View

What Spark is, the architecture from cluster manager to high-level APIs, RDD versus structured streaming, and data ingestion with MLlib.

49.4 What Comes Next

What to complete before the next class and student questions about the assignment and course material.

5Exam Guidance Summary

Consolidated guidance for the makeup exam, the second quiz, and the assignment deadline.

6Key Industry Applications

Real-world uses of the Kafka console demo, Spark ingestion, MLlib scoring, and Databricks.

Postgraduate students in Stream Processing and Analytics

Exam Revision Notes

Below is the distilled, exam-ready core. Every entry comes from the full explanation above. Use this section for rapid review; return to the main notes when a point needs more context.

Course Roadmap and Assessment Plan

Must-know: Makeup exam next week; second quiz in early May after the Flink module; finish assignment part one by end of month.

⚠️ Top pitfall: Starting both assignment parts at the same time is a general human tendency - complete part one early.

Self-check: Which module must be finished before the second quiz is taken?

Connects to: Kafka Streaming: Architecture Recap and Live Demo; Spark: A High-Level View.

Kafka Streaming: Architecture Recap and Live Demo

Must-know: Start order: Zookeeper, then broker (server id 0), then topic, producer, consumer. Producer flag is --broker-list; consumer uses --from-beginning.

⚠️ Top pitfall: Giving the console producer the consumer's --bootstrap-server flag; the producer stays stuck without its > prompt until --broker-list is used.

Self-check: Why must Zookeeper start before the Kafka broker?

Connects to: Spark: A High-Level View.

Spark: A High-Level View

Must-know: Spark Core handles task scheduling, memory management, fault tolerance, and data access; MLlib is the library the assignment uses.

⚠️ Top pitfall: Assuming RDD is still the recommended model - it is obsolete; structured streaming is the current API.

Self-check: What are Spark Core's four responsibilities?

Connects to: Kafka Streaming: Architecture Recap and Live Demo.

What Comes Next

Must-know: Environment setup (installation document) and assignment part one must be done before the next class.

⚠️ Top pitfall: Delaying part one so both assignment parts pile up at the end of the month.

Self-check: Which two things must be done before the next class?

Connects to: Course Roadmap and Assessment Plan.

Exam Guidance Summary

Must-know: Review Kafka producer and consumer concepts and the console demo for the makeup exam.

⚠️ Top pitfall: Confusing --broker-list (producer) with --bootstrap-server (consumer).

Self-check: When is the second quiz planned?

Connects to: Course Roadmap and Assessment Plan; Kafka Streaming: Architecture Recap and Live Demo.

Key Industry Applications

Must-know: Spark integrates with Hadoop HDFS, Kafka, and AWS; Databricks mirrors the local PySpark architecture.

Self-check: Which platforms can ingest data into Spark streaming?

Connects to: Kafka Streaming: Architecture Recap and Live Demo; Spark: A High-Level View.

Was this lecture useful?

Loading comments…
🤖

BitsNotes AI Assistant

Subject Notes Assistant

Configure AI Chat

Choose how to access the chatbot
Have your own API key?

Switch to "Bring Your Own Key" tab above for unlimited access with any OpenAI-compatible provider.

🔑 Enter API key above to fetch live models from provider, or enter model name manually.
OpenAI-Compatible API Support

Choose any provider preset (Gemini, DeepSeek, Kimi, GLM, MiniMax, Qwen, OpenAI, Groq, Ollama, etc.) or enter a custom endpoint URL.

Security & Privacy First

Your API key is sent directly from your browser to your specified provider. BitsNotes servers never store or see your key.