Kafka Use Cases and Architecture Notes

Event Driven Microservices

┌──────────────┐
│ Order Service│
└──────┬───────┘
       │ OrderCreated
       ▼

╔══════════════════════════════╗
║      Kafka Cluster           ║
║                              ║
║  Topic: order-created        ║
║  Partitions: P0 P1 P2 P3     ║
╚══════════════════════════════╝

       ▲            ▲            ▲
       │            │            │

┌─────────────┐ ┌─────────────┐ ┌─────────────┐
│ Payment Svc │ │InventorySvc │ │Shipping Svc │
└─────────────┘ └─────────────┘ └─────────────┘

This demonstrates loose coupling. Services communicate through Kafka events rather than direct synchronous REST calls.

Web Activity Tracking ✓ Correct

┌───────────┐
│ Web Users │
└─────┬─────┘
      │ Clicks
      │ Searches
      │ Cart Events
      ▼

╔══════════════════════════════╗
║ Kafka : user-events          ║
╚══════════════════════════════╝

      ▲          ▲          ▲
      │          │          │

 Analytics   Fraud AI   Recommendations

Kafka is commonly used to capture user behavior events in real time.

Sample Event

{
  "userId": "123",
  "eventType": "ADD_TO_CART",
  "timestamp": "2026-06-22T10:00:00"
}

Data Replication ⚠ Needs Clarification

┌───────────┐
│  Oracle   │
└─────┬─────┘
      │ CDC
      ▼

┌───────────┐
│ Debezium  │
└─────┬─────┘
      ▼

╔══════════════════════════════╗
║ Kafka : database-changes     ║
╚══════════════════════════════╝

      ▼

┌───────────┐
│PostgreSQL │
└───────────┘
Kafka itself does not replicate databases. CDC tools such as Debezium publish database changes into Kafka topics.

Enterprise Banking Architecture

┌─────────────────┐
│ Transfer Service│
└────────┬────────┘
         │ FundsTransferred
         ▼

╔══════════════════════════════╗
║ Kafka : transfer-events      ║
╚══════════════════════════════╝

    ▲          ▲          ▲          ▲
    │          │          │          │

┌────────┐ ┌────────┐ ┌────────┐ ┌────────┐
│ Fraud  │ │ Audit  │ │ Notify │ │ Ledger │
└────────┘ └────────┘ └────────┘ └────────┘

This pattern is commonly used in banking systems for event-driven processing.

Interview Ranking of Kafka Use Cases

Rank Use Case
1 Event Driven Microservices
2 CDC (Debezium)
3 Real Time Streaming
4 Log Aggregation
5 Web Activity Tracking
6 Event Sourcing
7 CQRS
8 Message Queueing
9 Data Replication
10 Fraud Detection