Course Hive
Search

Welcome

Sign in or create your account

Continue with Google
or
Background Workers with Kafka & FastAPI | Flight Booking Engine | Day 61
Play lesson

FastAPI & Next.js project: Flight Booking App With DevOps. Day 1 - 100 - Background Workers with Kafka & FastAPI | Flight Booking Engine | Day 61

5.0 (2)
23 learners

What you'll learn

This course includes

  • 104.5 hours of video
  • Certificate of completion
  • Access on mobile and TV

Summary

Keywords

Full Transcript

We fired the event—now we need to catch it. 🎣 In Day 61, we complete our Kafka integration by building the Consumer Engine. This is the code that runs in the background, listening for messages and executing the actual heavy lifting (like sending emails) without slowing down the API. The biggest challenge in FastAPI? Running a blocking Kafka Consumer alongside an asynchronous API. We will solve this using Python Threads and the asyncio event loop bridge. 💡 In this live build: The Consumer Engine: Building a threading.Thread loop to listen for Kafka messages continuously. Sync ↔️ Async Bridge: Using asyncio.run_coroutine_threadsafe to trigger async logic from a sync consumer. Event Handlers: Writing cleaner code by routing topics (e.g., user.events) to specific functions. The "Lifespan" Hook: Automatically starting and stopping the background worker when FastAPI boots up. Full Integration: Wiring up the Booking and Payment events to complete the system. By the end, we will have a fully functional Event-Driven architecture where user actions trigger instant background processes. 📘 Watch the full playlist: 👉 https://www.youtube.com/playlist?list=PLdtwawCR2QjmdfhM-7SzDOVGop373bbgW 📂 GitHub Repo (Public Mirror): 👉 https://github.com/KNehe/aero_bound_ventures-public.git Click to join Discord— https://discord.gg/BSQfs8SY 🔥 Subscribe to master complex backend patterns with FastAPI. #FastAPI #ApacheKafka #BackgroundTasks #PythonThreading #BackendDevelopment #EventDriven

Course Hive

Continue this lesson in the app

Install CourseHive on Android or iOS to keep learning while you move.

Related Courses

FAQs

Course Hive
Download CourseHive
Keep learning anywhere