Chaining Orchestration Components
The ability to run Orchestration Components in a certain sequence and connecting them together through dependencies is the very core of API Orchestration.
Chaining Orchestration Components in an Orchestration Flow
Every DX Component that is executed by the DX Engine has an input, some processing logic and an output. The input of a DX Component can come from the real-time Context provided in the API request or it can refer to the output of any other DX Component. The DX Engine builds a dependency tree in real-time based on these references between Orchestration Components when it processes the Experience API query.
Let's say that you need to display the items in Cart on a Shopping Cart page with real-time inventory. You need to call the Cart API from the commerce engine such as Salesforce or Commercetools before you fetch inventory from an Order and Inventory Management System like Fluent Commerce. In order to do this, you would create two components, one to call the Cart API and one to call the Inventory API. The DX Component fetching the inventory from the Inventory API will use the output of DX Component calling the Cart API for products in the shopping cart.
The DX Engine detects a dependency between two different Orchestration Components when one of the following is true:
- A DX Component refers to an output of another DX Component.
- A DX Component refers to the status of another DX Component
- A DX Component refers to a Context field that is updated by another DX Component. An example of this is provided in the Quick Start Guide in the Context Enrichment Section.
To learn how to use 'Expressions' in your API Orchestration flow, please take a look at the Expressions section in the Orchestration Components page.
There are various configurations within the DX Component that may refer to one of the above through the use of Expressions. Expressions allow for query-time evaluation of values using JavaScript syntax. Depending on where and expression is used, it has access to different set of variables/functions.
Here are the four DX Component configurations that use expressions:
- Trigger Expressions that determine whether or not a DX Component should be executed
- Expressions that determine if the response of this DX Component is valid
- Context Enrichment Expressions that allow the DX Component to update the real-time Context of the Experience API request. For example, a DX Component may update the Context of the API request with the Customer Segment of the customer based on a response from a CDP.
- Expressions that define the Context passed on to Sub-Components