Webhook delivery and business ordering 00:00:01 A parcel is already shipped A parcel-tracking service receives shipped, version three. Then it receives exactly the same event again. Later a distinct event says packed, version two. Which messages should change the customer’s delivery status? Authenticate the sender using the provider’s documented verification procedure. Persist the accepted event body, its stable event identifier and the parcel key in a durable inbox before acknowledging receipt. Suppose the sender retries while the original worker is busy. A uniqueness constraint on the event identity returns the previously accepted record. Two deliveries have now produced one durable unit of work. An event identity answers whether this exact delivery record has been accepted already. A parcel version answers whether its business information is newer. Keep both values, because there is no safe substitution between them. 00:00:56 Recognize the repeated delivery The second version-three message carries the same event identifier as the first. Its duplicate delivery does not create another inbox record or require the original business change to run twice. The worker applies shipped at source version three and durably records processing progress. An inbox row alone would not prove that the business effect had happened; completed and pending are distinct states. Acknowledge after durable acceptance rather than after every expensive downstream action. If acknowledgment is lost, the sender may still retry. Recovery must handle that familiar delivery pattern. Use one atomic operation for claiming the inbox identity. A read followed by an unguarded insert lets concurrent deliveries both claim first place. A duplicate can be acknowledged once the original durable work is recoverable. 00:01:48 An earlier version arrives later Now packed, version two, arrives with a new event identifier. It is new to the inbox. Would a duplicate filter alone protect the customer from seeing their shipped parcel become packed again? Compare versions for this same parcel. The visible snapshot is already version three. Version two is valid older information and cannot supersede it. Record the receipt if the contract needs it, then leave the current view at shipped. The version guard prevented a reversal that an event-identity check could never detect. This example assumes a monotonic version per parcel supplied by its source. Wall-clock timestamps from unrelated machines do not automatically provide that order. If the provider offers no version, use its specified reconciliation mechanism. 00:02:36 What about missing versions? If every transition triggers an obligation, retain the older event and reconcile the sequence with the authoritative source. A gap may mean waiting, replaying, or fetching a missing transition. If the obligation is only to show the latest complete parcel snapshot, a higher source version may safely supersede an older snapshot. An incremental patch may instead depend on the missing prior state. These are two consumers of the same delivery stream with different contracts. Decide whether intermediate business actions must happen, independently of how the public status page is rendered. A state projection can safely show the newest known snapshot while a separate audit or workflow waits for missing transitions. Document which outcome each consumer promises, and how it recovers a gap that never arrives. 00:03:26 Crash during processing Crash after accepting version three but before processing it. The inbox row remains pending. On recovery the worker can claim it again and continue from durable state. I apply the same state change idempotently, so reprocessing the same event doesn't break anything or create duplicates. The replay should end with one durable acceptance of the duplicated identity and a public parcel state of shipped at version three. Older version two remains observable to the consumers that need history. Perform local side effects and inbox progress in one transaction where possible. For an external notification, use a durable outgoing record and an idempotent receiver or downstream operation key so a restart does not send two business effects.