Function start

Source
pub async fn start() -> Result<(), Error>
Expand description

Sets up the runtime and starts the message broker listeners

The start function creates the structures used by the Runtime and starts the Reactor, Spawner and MsgBroker consumers.

  1. The Reactor - This includes the channel to send messages to the reactor and the Reactor struct itself. The Reactor is then run in a separate task and we await on the task’s Handle.
  2. The Spawner - First, a channel to communicate to the Spawner is created, then a new Spawner struct is created, passing in the Receiver for the channel. The Spawner is run in a background task and we await on the task’s Handle.
  3. The NATs consumer - This creates a NATs consumer listening for messages on the jobs.execute and jobs.cancel topics.