डिजिटल वस्तुओं का थोक मंच

Multi-Source Fulfilment Routing 2026: Suppliers के बीच order routing

Production multi-source routing algorithms: latency-weighted, stock-aware, cost-optimised, और B2B fulfilment के लिए failover।

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 करे।

FoxReload context: FoxReload POST /api/orders (https://public-api.foxreload.com) के through single API endpoint expose करता है — backend routing internally handle होती है। अगर आप FoxReload के अलावा अपने खुद के multiple suppliers manage करते हैं, तो यह article उसके लिए है।

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(productId: string): Promise<string> {
  const candidates = await getSuppliersForProduct(productId);
  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 करता है।

2. Stock-aware routing

अगर supplier का inventory buffer से कम है (e.g., popular product के लिए <50 codes) — अच्छी latency होने पर भी इसे primary की तरह avoid करें।

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;
}

3. Cost-optimised routing

अगर SLA allow करे (e.g., 5 minutes के अंदर fulfilment B2B के लिए normal है), wholesale cost पर optimise करें:

score = (1 / wholesale_cost) * sla_multiplier
where sla_multiplier = 1 if p95 < target else 0

बड़े 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:

import CircuitBreaker from 'opossum';

const breaker = new CircuitBreaker(callSupplier, {
  timeout: 8000,
  errorThresholdPercentage: 50,
  resetTimeout: 120000, // 2 min
});

breaker.fallback(() => fallbackSupplier());

FoxReload API के साथ Order Polling

FoxReload (या किसी भी supplier) से order होने के बाद, delivery के लिए poll करें:

curl https://public-api.foxreload.com/api/orders/{order_id} \
  -H "X-API-Key: YOUR_API_KEY"

status === "completed" होने पर items[].externalData[] में codes मिलते हैं। FoxReload में webhooks नहीं हैं — polling ही तरीका है।

CTA

FoxReload single API के नीचे suppliers auto-routing और failover के साथ aggregate करता है। Access पाएं और अपना fulfilment multi-source पर ले जाएँ।

अक्सर पूछे जाने वाले प्रश्न

FoxReload single API के पीछे multiple suppliers कैसे काम करते हैं?
FoxReload backend पर multiple suppliers aggregate हैं। आप POST /api/orders करते हैं — FoxReload internally routing handle करता है। यह article उन resellers के लिए है जो FoxReload के अलावा अपने own additional suppliers के साथ काम करते हैं और अपना routing layer बनाना चाहते हैं।
Primary supplier down हो जाए तो क्या होगा?
हर 10 seconds health checks (heartbeat + sample order)। 3 consecutive failures के बाद supplier DEGRADED flag होता है और traffic secondary पर shift होता है। Recovery के लिए 5 consecutive successful checks चाहिए।
Multi-source end-customer latency को कैसे affect करता है?
Routing decision के लिए 80–120ms add होते हैं (internal lookup) पर failover की वजह से p99 delivery 40–60% कम हो जाती है। बिना multi-source p99 = 90s; multi-source के साथ p99 = 38s।
क्या FoxReload API के साथ polling ज़रूरी है?
हाँ। FoxReload में webhooks नहीं हैं। Order status जानने के लिए GET /api/orders/{order_id} poll करें। Status 'completed' होने पर items[].externalData[] में codes मिलते हैं।
FoxReload API एक्सेस पाएं

संबंधित लेख