Suppose a user sends a money transfer transaction today. By the next second there will be 600,000 entries in the queue. After all those entries are processed, the system will listen to the transaction, but it doesn’t happen. How would you design the system to ensure immediate notification of transaction status to the sender and receiver?
💡 Model Answer
To guarantee instant status updates while handling a high‑volume queue, split the workflow into two logical streams. First, keep the original transaction stream for batch processing and persistence. Second, publish a lightweight status event to a dedicated Kafka topic (e.g., "transaction‑status") as soon as the transaction is accepted. Use a separate consumer group for the status topic so that a single consumer can process all status events in order and push them to a real‑time channel. For the channel, employ a push‑based mechanism such as WebSocket or a server‑sent event (SSE) endpoint that clients subscribe to. Store the latest status in a fast in‑memory cache (Redis or Memcached) keyed by transaction ID so that the client can poll or receive a push notification instantly. To avoid back‑pressure, use a priority queue or a separate high‑priority topic for status events, ensuring they are consumed before bulk transaction messages. Finally, implement idempotent consumers and retry logic to handle transient failures. This architecture decouples heavy processing from real‑time notification, scales horizontally, and guarantees that the sender and receiver receive status updates within milliseconds.
This answer was generated by AI for study purposes. Use it as a starting point — personalize it with your own experience.
🎤 Get questions like this answered in real-time
Assisting AI listens to your interview, captures questions live, and gives you instant AI-powered answers — invisible to screen sharing.
Get Assisting AI — Starts at ₹500