Business Object Document Sync processing pattern
The Business Object Document Sync processing pattern is used by systems that contain master data records to push out notifications when their data has changed. The Sync request contains the updated version of the business object and the request is sent out to all other listening systems to update their version of the business object.
Although the purpose of a Sync request is for systems to synchronize information pertaining to the business object, the processing pattern for Sync request is similar to the Change processing pattern. When processing the Sync request, the system updates its copy of the business object with the data from the Sync request. The Sync request will contain actions of what triggered the message to be sent and these actions correspond with the actions of a change request. In some cases, additional business logic is required but this business logic may be different then the actual change logic – for example, auditing or logging. When additional business logic is needed, a Post Sync Noun Part task command can be specified.
The following describes the detailed flow of the processing pattern:
- The Sync noun controller command breaks down the BOD and calls the read() to resolve the root objects of the nouns to Sync.
- The validate() method is called to perform any common validation required.
- An access control check is performed to ensure that current user has permission to Sync the specified noun.
- The Sync noun part task commands are instantiated and for each command, the validate() method is executed to report potential errors that can occur during processing.
- The Sync noun part command will read any information required and validate the input.
- The Sync noun part task command is executed to perform the change.
- The Sync noun part applies the changes.
- The Sync noun part saves any changes made to data objects retrieved in the current instance of the command.
- The post Sync noun part command is instantiated and executed.
- More data is read.
- Other data may be changed.
- Any changes are saved.
- The save is called on the object retrieved in step 1.
- The response is created and returned.