Ctrl K
Backend · Senior · Theory

After writing an order to the database, a service has to publish an event to a message broker. How do you guarantee the event isn't lost and that redelivering it doesn't duplicate the effect?

~4 min by voice

How to approach it

They're checking whether the candidate understands the problem of dual writes to a database and a broker, and can assemble a reliable chain: a transactional outbox for delivery, an idempotent consumer against duplicates, ordering, failure handling and monitoring. They also look at whether the candidate understands that end-to-end exactly-once doesn't exist.

Have you seen this question in a real interview?
Answers0
Avg. score—
Strong—
Practiced0
Topics
Similar questionsСервис заказов после оплаты кладёт событие в очередь, а сервис уведомлений его читает и отправляет пользователю пуш. Какие гарантии доставки бывают, почему пользователь может получить пуш дважды или не получить вовсе, и как это чинить? И как вы гарантируете порядок событий одного заказа? Mid-levelWhat is a message queue, and when should backend processing be moved into an asynchronous queue? JuniorDesign a notification service for push, email and SMS, handling about fifty million notifications a day, with spikes during marketing campaigns. SeniorHow do you test a service that processes events from a queue, for example from Kafka, and how do you deal with asynchrony in automated tests? SeniorA queue consumer processes "award bonus points" messages, and sometimes users get their bonus twice. Why does this happen, and how do you fix it? Mid-level

Answer by voice

The interviewer will ask this question and listen. Think out loud and ask for a hint if you need one. When you're done, pause or tap “That's my answer”. In about a minute, your score and the points you covered show up here.

Sign in to answer

Best with headphones · ~4 min