Coordinate two fulfillment workers across crashes and retries.

Instruction: Trace two workers and three crash points; specify when a retry is permitted and when the outcome must remain uncertain.

Context:

A fictional queue delivers order messages at least once. Two workers may receive the same intended shipment concurrently. A database can atomically insert a unique shipment-operation row. The external shipping API deduplicates identical key-and-payload requests for 24 hours after first acceptance; after that it may create another shipment. Queue retries continue for seven days. A status lookup can return a confirmed shipment, but a not-found result does not prove that an earlier in-flight request cannot complete.

Work through crashes before the external call, after the provider creates a shipment but before the local confirmation, and after 27 hours of uncertainty. Workers can pause and later resume. Explain the limits of leases and a transactional outbox.

Updated

Official answer available

Read the opening below, then unlock the full answer and practical guidance.

I would persist one operation ID and payload fingerprint per intended shipment, enforce uniqueness, and claim work atomically. A second worker must join that operation rather than invent a new shipping key...

Related Questions