In this video, I’ll walk you through setting up Kafka with NestJS, covering everything from producers and consumers to message partitioning for efficient event-driven architecture.
What You’ll Learn:
✅ Setting up Kafka locally with Bitnami
✅ Creating an Order Service (Producer), Logs Service (Consumer), and Notifications Service (Consumer)
✅ Understanding consumer groups and how they handle messages
✅ Partitioning messages for scalability and ordering
✅ Using keys to ensure related messages go to the same partition
✅ Handling Kafka messages in NestJS with emit() and send()
Buy me a coffee : https://buymeacoffee.com/computerix
📌 Chapters:
0:00 - Introduction
0:27 - Setting Up Kafka Locally
2:32 - Creating the Order Service (Producer)
5:32 - Sending messages to Kafka
7:41 - Monitoring our Kafka Server
8:57 - Creating the Notifications Service (Consumer)
13:08 - Accessing the Kafka Context
15:40 - Understanding Partitions & Consumer Groups
19:27 - Creating A Second Partition
21:30 - Running a Second Instance of Notifications Service
25:22 - Maintaining Message Ordering with Keys
28:15 - Creating a Second Consumer Group (Logs Consumer)
31:48 - Implementing the Request-Reply Pattern
41:03 - Video Summary