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.
- 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’sHandle
. - 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 weawait
on the task’sHandle
. - The NATs consumer - This creates a NATs consumer listening for messages
on the
jobs.execute
andjobs.cancel
topics.