Kafka Topics ๐ก
This document describes the Kafka topics used in ShopVerse, their purpose, producers, and consumers.
Kafka acts as the event backbone of the system, enabling loose coupling, scalability, and asynchronous processing.
๐ฏ Why Kafka in ShopVerse?โ
Kafka is used to:
- Decouple microservices
- Handle async workflows
- Prevent cascading failures
- Enable analytics & recommendations
- Support future extensibility
๐๏ธ Topic Overviewโ
| Topic Name | Purpose |
|---|---|
auth-events | Authentication-related events |
product-events | Product lifecycle events |
order-events | Order lifecycle events |
payment-events | Payment status events |
analytics-events | Unified analytics stream |
๐ auth-eventsโ
๐ Purposeโ
Tracks authentication-related actions.
๐ค Producersโ
- Auth Service
๐ฅ Consumersโ
- Notification Service
- Analytics Service
๐ฆ Event Typesโ
USER_REGISTEREDUSER_LOGIN
๐ฆ product-eventsโ
๐ Purposeโ
Tracks product catalog changes.
๐ค Producersโ
- Product Service
๐ฅ Consumersโ
- Notification Service
- Analytics Service
- Recommendation Service
๐ฆ Event Typesโ
PRODUCT_CREATEDPRODUCT_UPDATEDPRODUCT_DELETEDPRODUCT_STOCK_UPDATED
๐งพ order-eventsโ
๐ Purposeโ
Tracks order lifecycle changes.
๐ค Producersโ
- Order Service
๐ฅ Consumersโ
- Notification Service
- Analytics Service
- Recommendation Service
๐ฆ Event Typesโ
ORDER_PLACEDORDER_STATUS_UPDATED
๐ณ payment-eventsโ
๐ Purposeโ
Tracks payment lifecycle.
๐ค Producersโ
- Payment Service
๐ฅ Consumersโ
- Notification Service
- Analytics Service
- Order Service (optional sync)
๐ฆ Event Typesโ
PAYMENT_CREATEDPAYMENT_SUCCESSPAYMENT_FAILED
๐ analytics-eventsโ
๐ Purposeโ
Unified stream for analytics processing.
๐ค Producersโ
- All core services
๐ฅ Consumersโ
- Analytics Service (Flink job)
๐ Naming Conventionsโ
- Topic names use kebab-case
- Event types use UPPER_SNAKE_CASE
- One topic per domain
๐ Scalability Notesโ
- Topics are partitioned
- Consumer groups enable horizontal scaling
- Producers are stateless
๐ Summaryโ
Kafka topics in ShopVerse are:
- Domain-driven
- Clearly scoped
- Easy to extend
- Production-aligned
They form the communication contract between services.