Multi-Source Fulfilment Routing 2026: Order Routing Across Suppliers
Production B2B digital-goods fulfilment cannot depend on a single supplier. An exclusive supplier is a single point of failure: one outage and every order fails. The correct architectural pattern is multi-source routing with automatic selection of the best option per request.
1. Latency-weighted routing
The simplest variant is to pick the supplier with the lowest p95 delivery latency. Store historical metrics in a Redis sliding window:
type SupplierStats = { p95Ms: number; failureRate: number; stock: number };
async function pickSupplier(sku: string): Promise<string> {
const candidates = await getSuppliersForSku(sku);
const stats = await Promise.all(
candidates.map(s => redis.hgetall(`sup:${s.id}:stats`))
);
const scored = candidates.map((s, i) => ({
id: s.id,
score: 1 / (parseFloat(stats[i].p95Ms) + 1),
}));
return scored.sort((a, b) => b.score - a.score)[0].id;
}
This covers 80% of scenarios. Latency metrics refresh every 30 seconds from real webhook timings.
2. Stock-aware routing
If a supplier's inventory is below buffer (e.g., <50 codes for a popular SKU), avoid using it as primary even with good latency. The stock buffer prevents the race condition "4 concurrent orders for 3 codes".
function isViableSupplier(s: SupplierStats, qty: number): boolean {
const buffer = Math.max(50, qty * 3); // 3x safety margin
return s.stock >= buffer && s.failureRate < 0.05;
}
FoxReload pushes an inventory snapshot every 60 seconds into the internal cache. Partners using GET /v1/catalog/inventory get the same snapshot for their own routing.
3. Cost-optimised routing
If SLA allows (e.g., fulfilment within 5 minutes is normal for B2B), optimise on wholesale cost. Formula:
score = (1 / wholesale_cost) * sla_multiplier
where sla_multiplier = 1 if p95 < target else 0
This gives a hard SLA guarantee plus minimum cost. At scale (>10k orders/day) it saves 1.5β3% on marginal cost.
4. Failover and circuit breaker
Health-check pattern:
| Signal | Threshold | Action |
|---|---|---|
| 5xx rate over 5 min | >5% | Mark DEGRADED |
| Timeout rate | >2% | Mark DEGRADED |
| Heartbeat fail | 3 in a row | Mark DOWN |
| Recovery | 5 successful | Mark HEALTHY |
Circuit breaker pattern (Polly/resilience4j-style):
import CircuitBreaker from 'opossum';
const breaker = new CircuitBreaker(callSupplier, {
timeout: 8000,
errorThresholdPercentage: 50,
resetTimeout: 120000, // 2 min
});
breaker.fallback(() => fallbackSupplier());
In open state 100% of traffic moves to fallback β 2-minute cooldown, then a half-open canary check, then recovery.
CTA
FoxReload aggregates 40+ supplier pools under a single API with auto-routing and failover. Get access and move your fulfilment to multi-source.
