Skip to the content.

πŸ–₯️ 1️⃣ Ops Dashboard (Operations Dashboard) β€” Basics for Interview

A central place where Operations / Support / Admin teams can monitor, view, search, and troubleshoot system issues quickly without needing developer help.


βœ… Key features of a good Ops Dashboard (relevant to your project)

Feature Example in your project
Search / filter logs Search paymentID = 123, see its history
Status visibility See payment status = REFUNDED, FAILED, PENDING_MANUAL_REVIEW
Retry/Replay actions Retry failed refund or API call from UI
Alerts & Notifications DLQ has 5 failed refunds β†’ Ops gets alert
Traceability Trace full journey of transaction (via correlationID)
Audit Logs See which Ops person retried/reconciled

✨ Tech stack (practical for your project)

Tool Use
ElasticSearch + Kibana You already have for logs β†’ can build dashboards
Grafana (Optional) Nice dashboards with alerts
Custom Admin UI A simple Angular admin panel to view/retry DLQ messages
DLQ Viewer Custom page to view Kafka DLQ messages

πŸ’‘ What to say in Interview? (Sample)

β€œIn our project, we use ElasticSearch and Kibana to create Ops dashboards where our support team can view failed transactions (like payment refunds), DLQ messages, and even retry or escalate them manually. This reduces downtime and ensures eventual consistency even when automated compensation fails.”


πŸ“¦ 2️⃣ Outbox Pattern β€” Detailed & Practical

🧐 Problem first (why do we need it?)

In microservices: Let’s say your OrderService does this in a single REST API:

@Transactional
public void placeOrder(Order order) {
   // Step 1: Save order to DB
   orderRepository.save(order);

   // Step 2: Send event to Kafka
   kafkaTemplate.send("order-events", new OrderPlacedEvent(order));
}

⚠️ Problem β†’ If Step 1 succeeds but Step 2 fails (Kafka down / network issue) β†’ Your DB says β€œOrder placed” β†’ But no event was sent β†’ Data inconsistency


πŸ›‘οΈ Solution = Outbox Pattern

Steps

  1. Instead of sending Kafka event directly, save event to a DB table (outbox table) Same transaction as business data β†’ so both are safe
@Transactional
public void placeOrder(Order order) {
   orderRepository.save(order);

   OutboxEvent event = new OutboxEvent(
     "OrderPlaced", order.getId(), LocalDateTime.now(), "PENDING"
   );
   outboxRepository.save(event);
}
  1. A separate background thread (poller) keeps checking outbox table If event status = PENDING β†’ send to Kafka If successful β†’ mark SENT If fails β†’ retry or DLQ

πŸ—‚οΈ Outbox table schema

id event_type payload status created_at
1 OrderPlaced {orderId: 123} PENDING 2025-05-05
2 PaymentRefunded {paymentId: 987} SENT 2025-05-05

πŸ’‘ Key benefits

βœ… No data inconsistency βœ… Safe even if Kafka is down temporarily βœ… Works nicely with exactly-once semantics βœ… Can combine with Debezium (CDC) to automate event publishing (optional advanced)


✍️ What to say in Interview? (Sample Answer)

β€œTo avoid dual-write problems between DB and Kafka, we follow Outbox pattern. Our services first save business data + event in same DB transaction. A poller then reliably publishes events to Kafka and marks them sent. This guarantees consistency even if Kafka is down momentarily.”


πŸ† Summary for You

βœ… Ops Dashboard β€” Your Kibana + DLQ viewer β†’ for Ops to see, retry, reconcile βœ… Outbox Pattern β€” Helps when service emits events to Kafka after DB updates β†’ to keep data consistent