Events are structured historical records of things that happen in Horizon and the nodes, interfaces, and services it monitors. Events are central to the operation of the Horizon platform, so it’s critical to have a firm grasp of this topic. Whenever something in Horizon appears to work by magic, it’s probably events working in the background.
At the heart of Horizon lies an event bus. Any Horizon component can publish events to the bus, and any component can subscribe to receive events of interest that have been published on the bus. This publish-subscribe model enables components to use events as a mechanism to send messages to each other.
For example, the Horizon provisioning subsystem publishes a node-added event whenever a new node is added to the system. Other subsystems with an interest in new nodes subscribe to the node-added event and automatically receive these events, so they know to start monitoring and managing the new node if their configuration dictates. The publisher and subscriber components do not need to have any knowledge of each other, allowing for a clean division of labor and lessening the programming burden to add entirely new subsystems or modify the behavior of existing ones.