DEV Community

Cloudev
Cloudev

Posted on

Building a Simple Event-Driven Microservices System with Apache Kafka

After spending some time working with Amazon Kinesis, I wanted to explore how Apache Kafka compares when building event-driven systems. I’ve heard a lot about how teams use Kafka for micro-services communication, so I decided to get my hands dirty and build something small to understand how it works in practice.

Overview
I created a simple event-driven setup with three micro services that talk to each other through Kafka topics instead of direct API calls.

1.Order Service – Publishes an event whenever a new order is created.

2.Payment Service – Listens for order_created events, simulates payment processing, and publishes a payment_completed event.

3.Notification Service – Consumes payment_completed events and logs a message confirming the notification was sent.

This simple flow helped me understand how services can stay independent while still communicating in real time.

How it works
When you create an order, the Order Service sends an event to the order_created topic.
The Payment Service picks it up, processes it, and then publishes a new event to payment_completed.
Finally, the Notification Service listens for that and sends out a confirmation.

This flow replaces the need for synchronous REST calls, making the whole system more reliable and scalable a big difference I noticed compared to my earlier experiments with Kinesis streams

Lessons

  • Kafka feels more flexible for microservice communication than I expected, especially compared to Kinesis.

  • Running everything in Docker Compose makes testing distributed systems surprisingly simple.

  • Event-driven architectures really shine when you want services that scale and evolve independently.

What’s Next

I’m planning to add a Schema Registry and experiment with Kafka Streams for real-time processing. Later, I’ll probably try moving this setup to AWS MSK to get a managed Kafka experience.

If you’re curious about Kafka or want to see how microservices can talk through events, check out the project here
https://github.com/Copubah/kafka-microservices-demo

Top comments (0)