Synchronous service calls versus asynchronous job-based integration
Key Takeaway
A synchronous service call makes the storefront request wait until the third party responds or times out. Use it for live answers and keep its timeout low. Use a scheduled job when the data doesn't need to be current right now.
B2C Commerce connects to third-party systems in two main ways. A synchronous integration calls a service in real time through the web service framework, while the storefront request waits for the answer. An asynchronous integration runs as a job at a set time. The job moves data through files or API calls when no shopper is waiting on the result. Your choice decides whether shoppers see live data and how long they might wait for it.
Synchronous and asynchronous integration
B2C Commerce has two main integration interfaces: the web service framework and scheduled jobs. Both are available in Business Manager. Which one you use depends on whether the data must be current right now.
| Synchronous (real-time) | Asynchronous (batch) | |
|---|---|---|
| Interface | Web service framework | Scheduled jobs |
| When data moves | Immediately: data is visible or updated right away | At a specific time |
| Use it when | A stateless design needs live answers | Real-time data views or updates are not necessary |
| Examples | Loyalty points, tax calculation, a real-time order history view from an order management system (OMS) | Catalog imports from a product information management (PIM) system, order exports to an OMS, customer data exports to a CRM |
For tax calculation, send the whole basket in one request rather than one request per product line item. Per-item requests make the integration stateful and force retries when one item fails. They also risk hitting the quota of eight HTTP requests per storefront page.
The two interfaces are not either/or. One project can use both. The best practice is for a job to make its file uploads, downloads, and third-party API calls through the web service framework.