↓ Ir para o conteúdo principal

← todas as notas

📎 Webclip

3 Interview Questions on Event-Driven Patterns

The post frames three event-driven patterns as common system design interview topics and useful ideas for project work. It focuses on how queues distribute work, how failed messages are retried, and how async request-response stays traceable across multiple service instances.

Reading notes
#

  • Competing Consumers lets one or more producers send messages to a queue while multiple consumer instances compete to process them.
  • A message should be claimed by only one consumer, and different platforms enforce this with prefetch counts, in-flight delivery, peek-lock, or visibility timeout.
  • For retrying failed transactions, the post describes a setup with a main queue, an optional retry queue, and a dead letter queue.
  • The retry flow checks a retry count in message metadata, re-queues messages until the max retry limit, and then moves them to the DLQ.
  • The post recommends exponential backoff, idempotency, message TTL, retry limits, and separating transient from permanent errors.
  • In async request-response, the requester and responder may be different ephemeral instances, so the response may not return to the same instance that sent the request.
  • A correlation ID is used to match the response message to the original request across services.
  • The post says the correlation ID can be stored in a database, distributed cache, or local HashMap, and it travels with the request and response messages.
  • It also notes that correlation IDs can help with multiple requests for the same order and make tracing easier across services.