Remove bidirectional dependency between hostnameResource and configService #24
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "fix-bidirectional-hostnameResource-config"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Motivation
It is a architecture smell when component X depends on component Y yet simultaneously component Y depends on component X. In this case, the config manager needed access to the hostname resource to tell it when to update the hostname values, but the hostname resource also had access to the config manager to tell it when the hostname changed unexpectedly.
These bidirectional dependencies tend to cause problems later on, especially as a system grows more complex.
Solution
Having the hostname resource emit events for other components to subscribe to allows the config manager to fully own/manage the relationship between itself and the hostname resource.
This is also a step in the right architectural direction for having the config manager turned into more of a DiffEngine that manages divergence of target and actual state, allowing the system to be self healing