Using Kafka to Produce and Consume Messages Between Applications - FastAPI (Python)

Published: 19 September 2024
on channel: TechWithGio
1,813
50

In this video, I go over how to create a producer to send messages to a kafka topic and how to create a consumer to poll and consume messages from the kafka topic. You will also learn how to use the admin client to add or delete a topic using python code. Hope it helps! Thanks for watching!

Help my Coffee Addiction:
https://www.buymeacoffee.com/techwithgio

My Setup Gear
Disclaimer: I do get paid a percentage for any purchase made using any of the following links
Macbook Pro: https://amzn.to/454hwaI
Fujifilm XT4: https://amzn.to/3RsYAj1
Sony WH1000XM3: https://amzn.to/48qjBAQ
GIGABYTE M32U 32: https://amzn.to/3t3dsdR

00:00 Introduction
00:50 Docker Compose Zookeeper & Kafka
06:38 What will be done?
07:02 Producer Application Setup
08:28 Produce Message Schema
10:47 Intialize Producer & Helper Function
17:52 Creating a Topic with KafkaAdminClient
24:51 Creating Produce Message Route
30:16 Consumer Apllication Setup
31:56 Consumer Code Imports
33:44 Purpose for Consumer Application
34:38 Consumer Code
46:55 Consumer Trigger Endpoints
53:35 Testing the Applications



#tech #python #fastapi #kafka #eventdrivenarchitecture #techwithgio