← Case studies

Use case

Real-time stock updates: selling with today's stock, not yesterday's

Stock calculated overnight, wrong stock online, lost sales: lessons from a stock figure updated continuously, sending only what changes.

6 min readLahcen Ezzara

  • CDC
  • Boomi
  • Solace
  • Gravitee APIM
  • Retail
  • ERP
  • Event-Driven Architecture
We Are Beebay “Use case” visual on a navy background: real-time stock updates, selling with today's stock, not yesterday's.

$1.73 trillion: that is what stock-outs and overstocks cost global retail every year, according to IHL Group (2025). On the shop floor, the gap shows every day. A product sold in store at 10 a.m. stays “in stock” on the website until the next morning: orders are placed, then cancelled. The other way round, a product hidden as a precaution stays on the shelf without being sold online.

The cause is not a failure. It is a calculation run every night that works exactly as designed: it adds up the day’s sales, recalculates stock, then displays a figure that is already wrong when the stores open.

On a project for a large retail chain — more than a million stock lines, tills in every store and a fast-growing online shop — the overnight calculation gave way to continuous updates. Here is how, with which tools, and what it changes.

Wrong stock online means lost sales

According to the same study, nearly $1.2 trillion of those losses come from stock-outs: products customers want, missing from the right place at the right time. The rest comes from overstock.

Two problems add up. First, selling a product that is no longer there: the order is cancelled and refunded, sometimes with delivery costs for nothing. Second, not selling a product that is actually available: as a precaution, the website may show “out of stock” before real stock runs out.

It matters even more with customers who buy both online and in store. According to McKinsey (2022), these customers buy 1.7 times more often than customers who use a single channel.

“The more sales there are, the more wrong an overnight stock figure becomes.”

Running the calculation more often is not enough

The first idea is to run the calculation more often: every hour instead of once a night. The delay shrinks, but does not disappear. And the ERP has much more work to do.

Each run re-reads the entire stock in the ERP, the central system that also handles accounting, purchasing and deliveries. More runs mean more work for the ERP, even though only the lines changed since the last run would need re-reading. During sales and big promotions, it gets worse: more sales to process, longer runs, and a delay that grows at the worst possible moment.

So the real question is: how do we take each sale into account when it happens, without overloading the ERP?

From overnight calculation to continuous updates. Before: a sale in store at 10 a.m., a full stock calculation overnight, online stock updated the next morning, i.e. several hours late. After: only the sale is sent, and online stock is up to date within minutes.

From overnight calculation to continuous updates: one sale, two display delays.

Send only what changes

This method has a name: Change Data Capture (CDC). Instead of re-reading all the stock at a set time, the system sends only the changes: a new sale, a stock line that moves.

On the project, two sources feed this flow. Store tills send new sales every few minutes. The ERP provides recorded stock, re-reading only the lines that changed.

Available stock is then simple to calculate: ERP stock, minus the day’s sales already received from the tills. The system runs this calculation continuously, no longer once a night. Every night, the day’s sales total goes back to zero, once those sales are recorded in the ERP.

Available stock calculation: ERP stock (only changed lines are re-read) minus the day’s sales sent by the tills every few minutes. Example: 40 in stock in the ERP, 12 sold since opening, 28 available. Displayed stock never goes below zero.

Available stock: stock recorded in the ERP, minus the day’s sales.

Three tools, one role each

The solution relies on three well-known tools, each with a precise role.

Boomi collects and prepares. This integration tool reads new sales from the tills and changed stock lines from the ERP, formats them, then sends them. Boomi then calculates available stock in a separate database, kept apart from the ERP.

Solace delivers. This message broker receives each sale and passes it within seconds to the programs that need it. If a program stops, sales wait in a queue instead of being lost.

Gravitee gives access to stock. This secure gateway (an API) makes available stock accessible to the website and mobile apps. The website never reads from the ERP, only from the separate database.

Continuous stock updates, who does what: the tills and the ERP provide the changes; Boomi reads, formats and sends them; Solace queues and delivers them; available stock is calculated continuously in a database separate from the ERP; Gravitee gives secure access to the website, the mobile app and partners.

Continuous stock updates: the roles of Boomi, Solace and Gravitee.

The result: minutes instead of hours

First gain: online stock is finally up to date. A sale at the till shows in the stock displayed online within minutes, without waiting for the night. The pace is set store by store: from a few minutes to a quarter of an hour depending on the store.

Criterion Before: overnight calculation After: sending changes
Stock shown online Yesterday’s Up to date within minutes
Work required from the ERP Re-read everything on each run Re-read only what changed
Peak sales periods The delay grows Sales wait in the queue, then go through
New need (application, partner) New link to build with the ERP Plug into the existing flow

For the retailer, this means fewer cancelled orders, a safety margin that can be reduced, and a website that finally shows the real shelf stock.

The gain goes beyond stock. All sales now go through a single point: a delivery partner or a sales tracking tool can plug into it, without asking anything more of the ERP.

One flow, several uses: Boomi collects changes from the tills and the ERP and publishes them to Solace; the online shop and the mobile app already read stock through the API; a delivery partner or a sales tracking tool can plug in later.

One flow, reusable by new services without overloading the ERP.

What keeps the flow reliable day to day

Sending changes is not enough: the figures must also stay right over time. Four rules take care of that.

  • A single key. The store and the barcode together identify each stock line: every update lands in the right place, with no duplicates.
  • Recovery after an outage. Each store keeps the time of the last sale sent: after an outage, sending resumes exactly from there.
  • A safe calculation. The calculation runs completely or not at all, and displayed stock never goes below zero. If the ERP returns nothing, the system keeps the previous stock instead of wiping it.
  • Full monitoring. The monitoring tool records every run: an error shows up immediately and is fixed flow by flow.

The overnight calculation is still useful

The overnight calculation does not disappear, and that is deliberate. It remains useful when nothing is urgent: accounting, inventories, large data loads. The problem appears as soon as a sale depends on information held in another system.

The change happens in stages: stock first, because it is the information that pays off most when the figure is current, then other flows, once the gains are measured.

Key takeaways

A stock figure calculated overnight is wrong exactly when sales peak; running the calculation more often overloads the ERP without removing the delay. Sending only what changes — new sales, modified stock lines — gives accurate stock within minutes. A central message broker and a separate database protect the ERP and make it easy to plug in new services.

Measure the time between a sale at the till and its display online, then put a figure on lost sales: a few workshops are enough to know what late stock really costs you. Let’s talk.