Runbox.Runtime.Stage.TemplateCarrier (runbox v7.0.1)
Module implements producer_consumer GenStage behaviour, scenario template is used to handle events
Every scenario template is represented in stage based runtime by this module. TemplateCarrier uses
Runbox.Runtime.Stage.UnitRegistry
as its state (packed in Runbox.StateStore.Entity
envelope for StateStore
usage). UnitRegistry
provides functionality to lookup units via
subscriptions defined in scenario template.
If unit is located for given message,
Runbox.Scenario.Template.StageBased.handle_message/2
is used to handle this message. When
there is no registered unit for given routing key,
Runbox.Scenario.Template.StageBased.handle_asset_discovery/1
is used instead.
The state is updated in Runbox.StateStore.Entity
with
Runbox.StateStore.Entity.update_state/3
after every message is processed. Additionally,
before a message is processed it is confirmed that all messages with lower timestamps were
processed. This is done with Runbox.StateStore.Entity.ack_processed_time/3
and can result in
saving the state in state store.