Sitecore Experience Commerce

Understanding the Product Synchronization service layer

Abstract

Synchronizing core product data between Sitecore and external commerce systems.

Commerce Connect has its own product data model and Product Synchronization service layer for exchanging product data with one or more external commerce systems. The Product Synchronization service layer manages two-way synchronization of essential product data. The goal is to synchronize only the data that is needed to satisfy the most common e-commerce scenarios. In particular cases, the model can be extended. The default scenarios that are supported are described in the Commerce Connect Developer's Guide.

Note

For information about the availability of Product Synchronization, see dev.sitecore.net.

The synchronization is two-way, but can be forced in only one direction if needed. All service methods take a direction parameter, which is set to external system->Sitecore by default. A more radical, less flexible and static approach is to remove the pipeline processors, so that data is only written in one direction.

Synchronization of product data is done one language at a time. All service methods take a language parameter, which is set to English (EN) by default.

As with any other service layer in Commerce Connect, there is a domain model for product synchronization.

  • The objects in the domain model are used as data transfer objects (DTO) during synchronization of the product data to transfer information between the external system and Sitecore.

  • The domain model can be used for managing product data without having to deal with the actual storage, whether it is stored in Sitecore as items, or partially in the index and partially in an external system. For example, when querying the product index, it is possible to get instances of the product domain model in return for a single item that only contains a fraction of the data associated with the product. The hydration (data population) functionality built into Sitecore search and indexing can be used for this purpose.

The service layer also includes an item model that consists of a single product repository and associated repositories containing data related to products such as manufacturers, classifications and categories.

The Product Synchronization service layer is designed for two-way synchronization. In most setups, the product data is owned by the external system and only supports one-way synchronization; however, the framework has been created to support two-way synchronization.

The implementation of Commerce Connect uses a pattern similar to the Bridge design pattern. The product domain model serves as the data abstraction that hides its implementation in the external commerce system as well as in Sitecore. Each entity is read from both the external system and Sitecore. A comparison of the values between identical instances is executed, and the result is written back to both the external system and Sitecore. This means that each pipeline has the same pattern of processors for each type of entity, where the entity can be a product, manufacturer, division, or classification.

The two-way synchronization takes place in the following order:

  1. The entity is read from the external commerce system.

  2. The entity is read from Sitecore.

  3. The entities are compared and the differences are resolved. The default logic is based on simple comparison of date and time of the latest changes made at the item level in Sitecore and the external system respectively. The logic can be replaced with more advanced logic if needed.

  4. The results are written to the external system.

  5. The results are written to Sitecore.

The service layer methods take a direction parameter that indicates whether the synchronization is one-way from the external system to Sitecore, or vice versa, or two-way in both directions.

Depending on the value of the Direction parameter, some of the previously listed processors are skipped. For example, if the Direction parameter is set to inbound (external system -> Sitecore), there is no need to read the entity from Sitecore or write it back to the external system.

There are a number of different aspects that affect product synchronization performance.

The Commerce Connect Integration Guide describes the Product Synchronization service layer in more detail.