A booking platform tells your fulfillment system that an order was paid. Fulfillment creates the shipment request, then times out before the booking platform sees the response. The platform sends the same notification again. Your second shipment request now looks just as valid as the first.
Treat the notification and the business action as separate records. A delivery can repeat. It should still result in one shipment request for that paid order.
Follow a delivery through intake
- Receive Check the sender and event ID
- Persist Remember accepted events durably
- Process Use one key per shipment request
- Confirm Recheck uncertain outcomes before retry
Record the first delivery before acknowledging it
Verify the notification came from the configured sender, then store the event ID and accepted payload in a durable intake record. Use a unique constraint scoped to the sender and account so simultaneous deliveries cannot both insert a new intake record. Acknowledge accepted events after that write commits. Your worker can continue from that record if it restarts.
Keep processing state separately. When a duplicate arrives while the original is still queued, you can acknowledge the duplicate without scheduling a second job.
Key the side effect separately
If two valid events can both say order 412 is ready to ship, their event IDs will differ. Give the shipment request its own business key, such as the order ID and shipment number. When the destination supports idempotent requests, pass a stable key and reuse it on retries. For an ambiguous timeout without that guarantee, look up the destination record or queue a manual check before issuing another request.
Decide how to handle late updates. A delayed paid event for an order that has since been canceled should trigger a check of current order state.
Test the timeout you are afraid of
Send the same event twice and verify the system acknowledges both deliveries but shows one shipment request. Then simulate a successful destination write followed by a lost response. Put that uncertain action and its evidence on the operator’s screen. The test passes when the operator can resolve the original action without guessing whether they are about to ship twice.