module Rooibos::Message
Messages sent from commands to update functions.
All built-in response types live here. Each includes the Predicates mixin for safe predicate calls.
Constants
- All
-
Response from
Command.allaggregating parallel execution.Running multiple commands in parallel needs aggregated results. Without structured responses, handling mixed success/failure requires manual array parsing.
This response collects all child results and provides predicates for success checking. Include
Predicatesfor safe predicate calls.Use it to handle
Command.allcompletions.Example
case msg in { type: :all, envelope: :parallel, results: } model.with(outputs: results) end
- HttpResponse
-
Response from an HTTP command.
HTTP requests return status codes, bodies, and headers. Errors may occur. Without structured responses, handling success vs. error requires manual checks on raw data.
This response includes predicates for common checks and deconstructs for pattern matching. Include
Predicatesfor safe predicate calls on any message.Use it to handle
Command.httpcompletions.Example
case msg in { type: :http, envelope: :users, status:, body: } model.with(users: JSON.parse(body)) in { type: :http, envelope: :users, error: } model.with(error:) end
- Timer
-
Response from a timer command.
Timercommands fire after a delay. Pattern matching in UPDATE distinguishes multiple timers. Without structured responses, timers return bare symbols—hard to extend with elapsed time or other metadata.This response includes the envelope for routing and elapsed time. Include
Predicatesfor safe predicate calls on any message.Use it to handle
Command.waitorCommand.tickcompletions.Example
case msg in { type: :timer, envelope: :dismiss } model.with(notification: nil) in { type: :timer, envelope: :animate, elapsed: } model.with(frame: next_frame(elapsed)) end