The final unit sells at the till while the online store still shows one available. A synchronization service cannot make two disconnected systems update at the same instant. It needs a reservation policy, a stock authority and an honest limit on how stale availability can become.
How can a retailer synchronize inventory across systems?
Process stock changes through a durable queue and apply them to a versioned inventory ledger. Decide which system owns on-hand quantities, reservations and stock adjustments before publishing availability. Consumers must tolerate repeated or late events and reconcile periodically against source snapshots. Temporary disagreement is expected in an eventually consistent system. Safety stock, feed-lag warnings and a manual exception queue can limit exposure while stores and warehouses catch up.
Technical details
Stock changes need a recovery route
A successful update advances the stock ledger. A failed message enters a controlled replay route without losing its original event identity.
Azure FunctionsValidate source ID and version
Validate stock events and update read models.
→SKU-location event
Azure Service BusDurable queue and ordered sessions
Buffer stock changes and isolate failed messages.
→deduplicate and apply
SQL ServerVersioned stock ledger
Maintain versioned stock and reconciliation history.
↶
Transient failureBounded retry with the original event ID.
Controlled replayCheck versions again. Do not recount the sale.
Power BIRead-only conflict and feed-lag reporting
Report stock conflicts and lag by location.
Broker duplicate detection has a finite window. Ledger deduplication remains necessary.
Simplified implementation architecture. Open a technology to inspect its responsibility.
Version ownership and replay permissions
Broker duplicate detection has a configured time window and does not replace database deduplication. Limit stock-write credentials to the sync service. Monitor source lag, version gaps and dead-letter age. Record original and corrected quantities with reason and approver; restrict dashboards by store responsibilities.
Disconnect a store, then reconcile its history
Simulate offline tills, duplicate sales, returns, stock transfers and stale snapshots. Pilot a limited SKU range with conservative availability rules. Verify restore and replay from the ledger before expanding to every store.
Two systems can disagree without either event being lost
A till can record a sale while the online store still shows the previous balance. The question is how long that disagreement may last, which source owns the quantity and what happens when an older snapshot arrives later.
Stock ownership is a business rule. Transporting updates faster cannot resolve two systems that both claim authority over the same field.
Three decisions behind a balance that can be reconciled
Decision
What the record must preserve
Who owns the field?
Agree ownership by stock field
The warehouse may own physical stock while the commerce system owns reservations. Define available-to-sell as an approved calculation, including allocations and safety stock. Never add two absolute stock snapshots as if they were movement events.
Which change is newer?
Order changes within a stock key
Publish events with source event ID, SKU, location and source version. Use Service Bus sessions where ordered processing is needed for a SKU-location key. In SQL Server, deduplicate events and atomically update the ledger with optimistic version checks. Older snapshots cannot overwrite newer accepted state.
How does the ledger recover?
Reconcile after disruption
Publish versioned availability to each destination and record its acknowledgement. Retry transient failures within limits, then move poison messages to a dead-letter queue. A reviewed replay preserves the event ID. Compare periodic source snapshots and record who approved any corrective adjustment.
Interactive demo
A sale moves faster than the old stock snapshot
Follow a stock change between the till, the ledger and the online store. Compare source versions before deciding which update belongs in the current balance.
Local interactive demo
Stock version sandbox
Fictional records
STORE 01 / SKU-2086Demo on-hand units
v17Accepted source version
LATE WAREHOUSE SNAPSHOT6Source version 17
Send the events in different orders. A repeated sale and an older absolute snapshot must not increase the current quantity.
A synchronized stock service needs two views: whether balances reconcile and how long changes take to reach their destinations. The following definitions guide that review without implying achieved stock accuracy.
Does the quantity agree?
Inventory discrepancy rate
SKU-location balances outside agreed reconciliation rules divided by checked balances.
Overselling cancellations
Orders canceled for unavailable stock divided by accepted orders, using reviewed cancellation reasons.
How long does disagreement last?
Stock update lag
Source change time to destination acknowledgement, reported with clock-quality limitations.
Recovery time
Time from connection restoration to a fully reconciled location ledger.
Offline stores, stale versions and reconciliation
Will synchronization eliminate overselling?
No such guarantee follows from this design. Concurrent sales and offline stores create exposure; reservations, safety stock and source freshness rules must be agreed.
What does eventual consistency mean for a store?
A sale may take time to reach every connected system. The design makes that delay measurable and defines how availability behaves while updates are pending.
Who decides a conflicting stock quantity?
Field-level source ownership handles routine conflicts. An authorized inventory owner reviews unexplained differences and corrective adjustments.
Can failed messages be replayed safely?
Only if original event identifiers and version checks are retained. Replaying must not count the same sale or transfer twice.
Follow one SKU through a sale and a stock transfer
An inventory owner and a store manager can usually expose the important conflicts quickly. We can use that journey to agree quantity ownership, reservation behavior and the rules for reviewing an adjustment.