Contact us
Insights

When stock updates need a queue

Direct stock updates work until one system is slow or offline. The signs that it’s time for a queue, and what a queue fixes.

The problem

Direct updates break when one system is busy

The simplest stock integration sends each change straight to every other system: a sale on the till reduces stock in the ERP, which pushes the new level to the web shop. That’s fine while every system is up and fast. When the web shop is slow during a sale, or the ERP is down for an update, those direct calls fail or time out. Changes are lost or applied late and in the wrong order, and stock drifts until someone notices an oversold product.

Signs to watch for

Your stock updates probably need a queue if…

Stock is wrong after a busy day or an outage

How we solve it

Updates made while a system was slow or offline were dropped, and nothing went back to send them.

Tills slow down when the web shop is busy

How we solve it

Each sale waits for other systems to reply, so one slow system holds up the others.

Older levels overwrite newer ones

How we solve it

Two updates for the same product arrive out of order, and the stale figure wins.

You fix stock with a nightly full resync

How we solve it

A complete overwrite hides the gaps, but stock is wrong for most of the day in between.

The fix

What a queue changes

A queue sits between the system where stock changes and the systems that need to know. The till or ERP records the change in the queue and carries on straight away. A separate process delivers each change, in order, to each system that needs it. If a system is down, its changes wait in the queue and are delivered when it comes back, so nothing is lost and nothing is retyped. The queue also shows how far behind each system is, which is the early warning you need.

Design notes

Getting a stock queue right

Send movements, or the latest level

Either send each movement, such as “sold 2”, in strict order, or send the latest level with a timestamp and ignore anything older.

Keep order per product

Updates for one product must arrive in the order they happened; different products can be processed side by side.

Make delivery safe to repeat

A queue may deliver a message twice. Give each movement an ID so it’s only applied once.

Hold failures, don’t drop them

A message that keeps failing, such as an unknown product code, moves to a holding area with the reason, so the rest keep flowing.

When a queue is more than you need

Not every business needs one. If you sell through one channel, stock changes slowly and a few minutes’ delay is harmless, a scheduled sync that sends recent changes every few minutes may be enough. For example: a wholesaler taking a handful of trade orders an hour can usually work from a five-minute sync. A queue earns its place when several channels sell the same stock, volumes spike, or an oversold item costs you a customer.

Is your stock out of step between channels?

Tell us where you sell and which system holds your stock. A few lines are enough.

Tell us what’s not working