Runbox.Runtime.Stage.SelectorBuilder (runbox v7.0.1)

Selector function generator which is used to filter messages between GenStage phases.

Stage based runtime uses BroadcastDispatcher to dispatch messages between TemplateCarriers, this kind of dispatcher support message selector function to be passed as part of GenStage subscription. This module is used to generate this function based on template configuration.

Link to this section Summary

Functions

Builds GenStages BroadcastDispatcher filter function based on template configuration.

Link to this section Functions

@spec build([{String.t() | atom(), term()}]) ::
  (Runbox.Runtime.OutputAction.t() | Toolbox.Message.t() -> boolean())

Builds GenStages BroadcastDispatcher filter function based on template configuration.

Filter function is produced based on Runbox.Scenario.Template.StageBased.subscriptions/0 callback result.

Subscription is defined as {message_type, _routing_rule}, we use only message_type part of subscription. All message types are stored in produced function clojure and dispatched message type is matched against them.

Exception to the message type matching are output actions and tick messages which are always matched.