BB.Reactor.Step.WaitForEvent (bb_reactor v0.2.3)

Copy Markdown View Source

Reactor step that waits for a BB PubSub event.

This step subscribes to BB.PubSub and waits for a message matching the specified path and optional filter function.

Options

  • :path - (required) The PubSub path to subscribe to (e.g., [:sensor, :force])
  • :timeout - Timeout in milliseconds (default: :infinity)
  • :message_types - List of message payload modules to filter (default: [] for all)
  • :filter - Optional function to filter messages: fn message -> boolean end

Result

Returns the matching BB.Message struct on success.

Examples

step :wait_for_force do
  impl {BB.Reactor.Step.WaitForEvent,
    path: [:sensor, :force_torque],
    timeout: 5000,
    filter: fn msg -> msg.payload.force > 10.0 end}
end