Step | Description | |||
1 | A data change occurs on a source, and the source sends a notification document. | |||
2 | A notification service that you create to notify targets of a data change invokes the pub.synchronization.latch:isLatchClosed built‑in service to determine whether the latch for the object is open or closed. Initially for the source, the latch for the object that was changed is open. This indicates that updates can be made to this object. The object is identified in the cross-reference table by the following cross-reference table fields and the latch is considered open because isLatchClosed is false: | |||
appId | objectId | canonicalKey | isLatchClosed | |
CRM system | Account | WM6308 | false | |
Finding that the latch is currently open, the notification service builds the canonical document and publishes it. The notification service invokes the pub.synchronization.latch:closeLatch built-in service to close the latch. This sets the isLatchClosed field to true and indicates that updates cannot be made to this object and prevents a circular update. After the latch is closed, the cross‑reference table fields are as follows: | ||||
appId | objectId | canonicalKey | isLatchClosed | |
CRM system | Account | WM6308 | true | |
3 | Because the source is also a target, it subscribes to the canonical document it just published. The trigger passes the canonical document to a service you create to update the resource when a data change occurs. This update service invokes the pub.synchronization.latch:isLatchClosed built‑in service to determine whether the latch is open or closed for the object. Finding that the latch is currently closed, which indicates that the change has already been made, the update service does not make the update to the object. The update service invokes the pub.synchronization.latch:openLatch built‑in service to re‑open the latch to allow future updates to the object. After the latch is open, the cross‑reference table fields are as follows: | |||
appId | objectId | canonicalKey | isLatchClosed | |
CRM system | Account | WM6308 | false | |
4 | A service you create to update the target when a data change occurs receives the canonical document. This update service invokes the pub.synchronization.latch:isLatchClosed built‑in service to determine whether the latch is open or closed for the object. Initially, the cross‑reference table fields for the target object are as follows: | |||
appId | objectId | canonicalKey | isLatchClosed | |
Billing system | Account | WM6308 | false | |
Because initially the isLatchClosed column is set to false, this means the latch is open and updates can be made to this object. To make the update, the update service maps information from the canonical document to a native document for the target resource and sends the document to the target. The target resource uses this document to make the equivalent change. The update service uses the pub.synchronization.latch:closeLatch built-in service to close the latch. This indicates that updates cannot be made to this object and prevents a circular update. After the latch is closed, the cross‑reference table fields are as follows: | ||||
appId | objectId | canonicalKey | isLatchClosed | |
Billing system | Account | WM6308 | true | |
5 | Because the target made a data change, it sends notification of a change. | |||
6 | Because the target is also a source, when it receives notification of a data change, it attempts to notify other targets of the data change. A notification service that you create to notify targets of a data change invokes the pub.synchronization.latch:isLatchClosed built‑in service to determine whether the latch for the object is open or closed. Finding that the latch is closed, which indicates that the change has already been made, the notification service does not build the canonical document. The notification service simply invokes the pub.synchronization.latch:openLatch built‑in service to re-open the latch. Because the latch is now open, future updates can be made to the object. After the latch is open, the cross‑reference table fields are as follows: | |||
appId | objectId | canonicalKey | isLatchClosed | |
Billing system | Account | WM6308 | false |