Commerce Connector Set Model
Introduction
A Bloomreach Accelerator: B2C Commerce application uses the Commerce Connector Set model to invoke the commerce backend services at runtime. Such a Commerce Connector Set model is maintained in a Commerce Connector document in the CMS. The fields in the document are mapped to the properties of Commerce Connector Set model objects.
The Commerce Connector Set model is refreshed automatically if the corresponding Commerce Connector Set document is updated and republished.
Overview
A Commerce Connector Set model contains all the information necessary for applications to communicate with the commerce backend services. Bloomreach Accelerator: B2C Commerce applications invoke the backend services via a logical Commerce Connector and Commerce Connector Components. Only the detail configurations for your Commerce Connectors and Commerce Connector Components include the physical backend connection and invocation metadata. So, application logic can remain loosely coupled with the commerce backend APIs.
Below is the logical view of the Commerce Connector Set model. CommerceConnectorSetProvider is a service interface which can be retrieved from HippoServiceRegistry. You can get access to the Commerce Connector Set models through this service interface.
CommerceConnectorSet consists of multiple CommerceConnectors, each of which consists of multiple CommerceConnectorComponents. A CommerceConnector contains common connection information for a specific commerce backend, and a CommerceConnectorComponent contains all the detailed information for an invokable unit under the CommerceConnector.
CommerceConnectorSet model
A CommerceConnectorSet contains all the CommerceConnectors for a Bloomreach Accelerator: B2C Commerce application.
Below is the list with all available properties for CommerceConnectorSet model.
Property name | Field name (CMS) | Description |
---|---|---|
id | N/A | The unique identifier of a CommerceConnectorSet model. The default implementation returns the underlying document handle node's identifier. |
title | N/A | The title of a CommerceConnectorSet model. The default implementation returns the underlying document's title in CMS. |
published | N/A | Whether this CommerceConnectorSet model is published. The default implementation returns true if the underlying document is published. |
CommerceConnector model
A CommerceConnector model contains all required mapping information to resolve a proper CRISP API ResourceResolver.
Below is the list with all available properties and their corresponding compound fields for a CommerceConnector model.
Property name | Field name(CMS) | Description |
---|---|---|
id | Connector ID | The unique identifier of a CommerceConnector model. e.g, "bloomreach". |
resourceSpace | Resource space | The resource space name to resolve the corresponding CRISP API ResourceResolver. |
CommerceConnectorComponent model
A CommerceConnectorComponent model contains metadata for an invokable unit, using CRISP API.
Variable Interpolation in CommerceConnectorComponent
Some properties of a CommerceConnectorComponent model should be determined dynamically at runtime because the URI path or other parameters for the commerce backend REST API endpoint needs to be expanded with the caller's context variables. For this reason, Bloomreach Accelerator: B2C Commerce internally uses a FreeMarker-based TemplateProcessor to interpolate the variables. For example, if the serviceBaseUrl property is set to "products/${externalReferenceId}" and the context variables contain a value, e.g. "12345" for the externalReferenceId variable, then the serviceBaseUrl property will be resolved to "products/12345" at runtime to invoke the underlying CRISP API.
Bloomreach Accelerator: B2C Commerce collects variables from the following as ordered:
- Each attribute name and value pair from the current HttpServletRequest or HstRequest attributes
- Each parameter name and value pair from the current HstComponent parameters
- Each parameter name and value pair from the current ResolvedSitemapItem parameters
- The current ChannelInfo (ie, com.bloomreach.commercedxp.starterstore.channels.StarterStoreChannelInfo) object by its variable name, "channelInfo", if available.
Properties of CommerceConnectorComponent
Below is the list with all available properties and their corresponding compound fields for CommerceConnectorComponent model.
Property name | Field name(CMS) | Description | Interpolation |
---|---|---|---|
id | Component ID | The unique identifier of a CommerceConnectorComponent model. e.g, "productDetail", "productList", etc. | No |
servceBaseUrl | Service base URL | The relative URI path to be used in commerce backend REST API invocations using this CommerceConnectorComponent model. e.g, products/${externalReferenceId} | Yes |
pathVariables | Path variables | The variables map to be passed to the underlying Spring Framework RestTemplate used by CRISP API, which expands variable expressions encosed by curly braces without a leading dollar sign. e.g, ...{varName}... | Yes |
methodType | Method type | The HTTP method name to be used when invoking CRISP API for the commerce backend service. "GET" by default. | No |
headers | HTTP headers | HTTP headers if required by the commerce backend REST API. | No |
cookies | HTTP cookies | HTTP cookies if required by the commerce backend REST API. | No |
requestBody | Request body | HTTP request body message if required by the commerce backend REST API. | Yes |