When building a service-oriented architecture, it is important to identify which components will be responsible for which information. For a particular “truth”, you must ensure that your system defines a single component that is responsible for it.
For a given piece of information, there are typically applications that can modify that information and other applications that depend upon that information. Often, the modifying application will also use the information (at the very least, it will likely show the user the current state). It is important to ensure that the application that modifies the information does not get a “head start” on learning what the new information is. Any component that uses the information should only update its version of the “truth” when the single source of truth tells it to do so, not when another component of the same process initiates the state change.
For example, consider a user interface that allows an administrator to adjust the price of a product available in your online store. There are several other processes that need to know the price of that product (such as the web servers that process client orders). When the administrator adjusts the product’s price via the administrative interface, the interface should send a request to the “single source of truth” that is responsible for product prices (this is probably a separate service process). The administrative interface should not indicate that the product’s price has changed until that single source of truth has published that information publicly, even though the change originated from that interface.
To see why this is important, consider what would happen if the single source of truth were down, or the request to change the state failed. If the application that requested the state change updated its copy of the data before sending the request, it would be using state that is different from all the other systems that have no way of knowing about the local change. In our example, the admin app would be displaying a price for widgets that is not being used by any of the order processing services – and therefore presenting incorrect information to the administrator.
Any representation of a particular piece of data should only be updated by an explicit command from the single owner of that data — the single source of truth. This principle will help keep your systems consistent and accurate.