The Event Bus

At the heart of Meridian lies an event bus. Any Meridian 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 provisioning subsystem of Meridian 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 Meridian subsystems or modify the behavior of existing ones.

Associate an Event to a Given Node

There are two ways to associate an existing node to a given event prior sending it to the event bus:

  • Set the nodeId of the node in question to the event.

  • For requisitioned nodes, set the _foreignSource and _foreignId as parameters to the event. Then, any incoming event without a nodeId and these two parameters will trigger a lookup on the DB; if a node is found, the nodeId attribute will be dynamically set into the event, regardless of which method has been used to send it to the event bus.