Skip to content

Latest commit

 

History

2 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 

Repository files navigation

Event-Driven Microservices

Order processing system using event-driven architecture with Kafka, CQRS pattern, and Go microservices.

Features

  • Event-driven communication via Apache Kafka
  • CQRS (Command Query Responsibility Segregation)
  • Saga pattern for distributed transactions
  • Multiple microservices: Order, Payment, Inventory, Notification
  • Event sourcing with replay capability
  • Health checks and graceful shutdown

Tech Stack

Component Technology
Services Go
Messaging Apache Kafka
Databases PostgreSQL (per service)
Containerization Docker, Docker Compose
API Gateway NGINX

Architecture

┌───────────┐   ┌───────────────────────────────────┐
│  Client   │──▶│           API Gateway              │
└───────────┘   └──────┬────────────┬────────────────┘
                       │            │
              ┌────────▼──┐  ┌─────▼────────┐
              │  Order    │  │  Query       │
              │  Service  │  │  Service     │
              └─────┬─────┘  └──────────────┘
                    │ publish
              ┌─────▼─────┐
              │   Kafka   │
              └──┬──┬──┬──┘
        consume  │  │  │
     ┌───────────┘  │  └───────────┐
     │              │              │
┌────▼─────┐ ┌─────▼────┐ ┌──────▼────────┐
│ Payment  │ │Inventory │ │ Notification  │
│ Service  │ │ Service  │ │ Service       │
└──────────┘ └──────────┘ └───────────────┘

Services

Service Port Responsibility
Order 8081 Create/manage orders
Payment 8082 Process payments
Inventory 8083 Stock management
Notification 8084 Email/SMS alerts
Query 8085 Read-optimized queries (CQRS)

Kafka Topics

Topic Producer Consumers
order.created Order Payment, Inventory
payment.processed Payment Order, Notification
inventory.reserved Inventory Order
order.completed Order Notification, Query

Getting Started

docker-compose up
# Order API at http://localhost:8081

Roadmap

  • Project setup
  • Kafka + Zookeeper Docker setup
  • Order service with event publishing
  • Payment service consumer
  • Inventory service consumer
  • Notification service
  • CQRS query service
  • Saga pattern implementation
  • Health checks
  • Integration tests

License

MIT

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors