Learn / Wiring

How the assembly uses a wiring

  • Routing takes the first claimant in list order. route returns an Option: Some when the Message is this wiring's, None otherwise. A key-value mirror returns None for another mirror's MirrorRestored; that is what lets the tag be shared. A placement folds a Message when its wrapper unwraps it, and ignores the rest the same way.
  • init steps run placements first (shallowest first), then wirings in list order. A mirror's restore is an ordinary Command in the returned config; whoever mounts the app dispatches it like any other startup Command.
  • Subscriptions merge by key. A duplicate key throws, as Subscription.aggregate does. The merged record carries the union of the items' service requirements, so a Remote wiring pulls RemoteClient into the runtime's resources layer type.
  • url folds every onUrl. Its init applies each wiring's URL read to the Model; its onUrlChange builds the Message a wiring routes.
  • module collects contracts. Placements contribute a contract owning their Model path; each wiring contributes its own contract as-is, so Module.validate sees every owner in the one list. A wiring with no contract (nothing owned, nothing observed) contributes nothing.