Skip to main content

Marketplace order ingestion

Trigger. SyncJobScheduler cron * * * * *, order offset 0 within the minute.

Entry. sync_queue job order → SyncJobProcessorWorker → marketplace orderService → MarketplaceOrderIngestionService.

Observed​

  • Runs in tenant context.
  • Inactive tenants or inactive subscriptions are excluded by the scheduler query.
  • Unsupported channel types are skipped with a warning.
  • The transaction writes the order and enqueues order.created when there are items and the outbox writer exists.
  • Address validation is enqueued after that (validate-pending-order).
  • Repeated failures suspend the channel. See Channels.

Synchronous versus asynchronous​

The sync job is already async relative to any human click. Inside the job, the order commit is synchronous with the outbox insert. Fulfillment still waits for the outbox dispatcher.

Idempotency​

Orders are matched on (channelOrderId, channelId): a known order goes through MarketplaceOrderIngestionService.update, a new one through create, so a re-sync updates rather than duplicates. Lines are matched by orderItemId (OrderItemSyncService). SyncJobLog records runs.

Per-order failures​

Each order is imported on its own (ChannelOrderSyncRun): one that fails is counted and kept to re-read by id next run, and the rest of the page goes on. The sync watermark moves only when the window was read to the end and every failure is kept; see Integrations overview.

Failure​

Bull attempts: 3, exponential backoff 5 seconds. Then the circuit breaker can set SUSPENDED. A throw before commit rolls the order back. The next successful attempt can insert it.

Concurrency for the order job is 15.