Multi-Source Fulfilment Routing 2026: Suppliers के बीच order routing
Production B2B digital-goods fulfilment single supplier पर depend नहीं कर सकता। Exclusive supplier एक single point of failure है: एक outage और हर order fail। सही architectural pattern है multi-source routing जो हर request पर best option automatically select करे।
1. Latency-weighted routing
Simplest variant — supplier को lowest p95 delivery latency से pick करना। Historical metrics Redis sliding window में store करें:
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;
}
यह 80% scenarios cover करता है। Latency metrics हर 30 seconds real webhook timings से refresh होती हैं।
2. Stock-aware routing
अगर supplier का inventory buffer से कम है (e.g., popular SKU के लिए <50 codes) — अच्छी latency होने पर भी इसे primary की तरह avoid करें। Stock buffer "4 concurrent orders for 3 codes" race condition से बचाता है।
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 हर 60 seconds inventory snapshot internal cache में push करता है। GET /v1/catalog/inventory use करने वाले partners को अपनी routing के लिए same snapshot मिलता है।
3. Cost-optimised routing
अगर SLA allow करे (e.g., 5 minutes के अंदर fulfilment B2B के लिए normal है), wholesale cost पर optimise करें। Formula:
score = (1 / wholesale_cost) * sla_multiplier
where sla_multiplier = 1 if p95 < target else 0
यह hard SLA guarantee + minimum cost देता है। बड़े scale पर (>10k orders/day) यह marginal cost पर 1.5–3% बचाता है।
4. Failover और circuit breaker
Health-check pattern:
| Signal | Threshold | Action |
|---|---|---|
| 5xx rate 5 min में | >5% | Mark DEGRADED |
| Timeout rate | >2% | Mark DEGRADED |
| Heartbeat fail | लगातार 3 | 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());
Open state में 100% traffic fallback पर जाता है — 2-minute cooldown, फिर half-open canary check, फिर recovery।
CTA
FoxReload single API के नीचे 40+ supplier pools auto-routing और failover के साथ aggregate करता है। Access पाएं और अपना fulfilment multi-source पर ले जाएँ।
