Runbox.Runtime.Stage.TemplateImpl (runbox v1.2.0)

Module encapsulates scenario template callback calls.

Scenario defines Toolbox.Runtime.Stage.Unit as state carrier, these units are organized into Runbox.Runtime.Stage.UnitRegistry which is helper structure to route messages between units managed by one template.

Messages are handled via Toolbox.Scenario.Template.StageBased callbacks. We distinguish two types of messages = message to existing unit and message to new unit (asset discovery).

Messages that doesn't have any unit registered and thus found to handle them, we call this situation asset discovery and use Toolbox.Scenario.Template.StageBased.handle_asset_discovery/1 callback to handle these message. New unit may or may not be created here, but when it does, it needs to be initialized via Toolbox.Scenario.Template.StageBased.init/2 callback.

When there is at least one unit which is registered to the message, we use callback Toolbox.Scenario.Template.StageBased.handle_message/2. Unit may be updated or stopped here.

We support timeouts to be defined. These timeouts are triggered via external time, which is derived from incomming message timestamps. Timeouts are registered for one unit.

Some output actions produced by any of template callback should be further updated. Events require filling run id and notifications require scenario id to be filled.

Link to this section Summary

Link to this section Functions

Link to this function

handle_message(oa, template, state, scenario_id, run_id, ctx)

Link to this function

init_state(template, state, timestamp, scenario_id, run_id)