The Data Sync Tool is responsible for moving (sometimes referred to as "merging" or "syncing") changes from one Elastic Path environment to another. For example, in an environment with a staging instance and a production instance of Elastic Path Commerce, changes on the staging instance need to be synced to the production instance. First, objects that need to be modified are placed in a Change Set. When all changes have been made, the Change Set is locked on the staging instance and the objects can no longer be modified. Then, the Data Sync Tool is used to transfer the changes to the production instance. After the changes are applied to the production instance, a message is sent back to the staging instance to indicate that the the Change Set can be unlocked, making the objects available for editing again.
During the merge process, the following occurs:
- The Data Sync Tool retrieves the Change Set from the source instance.
- It creates a package containing the objects as binary data and a job descriptor. The job descriptor contains the list of exported objects and the actions to perform on each one as it is brought into the target instance (add/update or delete).
- The Data Sync Tool passes the job descriptor and binary data to the target instance.
- The target instance examines the job descriptor and determines what to do with each object:
- If the object does not exist in the target instance, it is added as a new object.
- If the object exists in the target instance, it is updated with any changes that were made in the source instance.
- If the object has been marked for deletion in the job descriptor, then the object is deleted.
There are two ways to synchronize a Change Set between a source and a target instance of Elastic Path Commerce:
- First Way: transfer it directly to the target. To use this method, the source and target systems must be able to communicate over HTTP(S).
- Second Way: export it from the source to the file system and then import it from the file system into the target. This method can be used if the source and target are not able to communicate directly, for example, if the source and target are on segregated networks. In this case, the exported data must be transferred by some other means.