docs
Systems
Execution
FlowControllerSystem
Key Components

FlowControllerSystem Components

FlowController

Role: The base class for all flow controllers. It is the only type in this system.

Responsibilities:

  • Registers its command handler for its Domain on the command bus during Init.
  • Defines the abstract HandleCommand method that subclasses implement.
  • Exposes the abstract Domain property that identifies the controller's domain.

Lifecycle:

  1. A subclass is constructed in InitializationManager.RegisterSystems, typically through SafeRegister.
  2. InitializationRegistry stores it as a sync initializable, because it does not implement the event receiver interface.
  3. InitializationOrchestrator calls Init, which registers HandleCommand with the command bus.
  4. Commands addressed to the controller's domain are delivered to HandleCommand.

Subclasses (implemented by consuming projects)

Each project creates one subclass per domain. A subclass:

  • Overrides Domain to return its Domain value.
  • Implements HandleCommand to process commands for that domain.
  • Overrides Init only when extra setup is needed. It must call base.Init().
  • Obtains other buses, such as the query bus, through ServiceLocator if needed. The base class does not provide them.

Interaction with dependency classes

ClassInteraction
InitializationManagerCreates the controller through SafeRegister during RegisterSystems. Initializes ServiceLocator before that call.
InitializationRegistryStores the controller in the sync initializables list.
InitializationOrchestratorCalls Init during the sync initialization phase.
ServiceLocatorProvides the bus registry from which the CommandBus is obtained.
CommandBusReceives the Register(Domain, HandleCommand) call and routes commands by TargetDomain.
ICommandThe payload type passed to HandleCommand.
Domain (enum)The routing key that identifies each controller.