What you'll learn
- How
signal_routes/1maps signal types to action modules. - How
AgentServer.call/2handles request/response style updates. - How
AgentServer.cast/2queues async routing while state converges. - How to inspect execution history with before/after state snapshots.
How signal routing works
The SignalRoutingAgent declares three routes:
"increment"→IncrementAction"set_name"→SetNameAction"record_event"→RecordEventAction
Each route is validated by the action schema and then applied to immutable
agent state. The LiveView keeps a running view of counter, name, and
recorded events so you can inspect behavior after every signal.
call vs cast behavior
- call executes synchronously and returns the updated agent immediately.
- cast enqueues signals asynchronously and returns
:okimmediately.
In this demo:
callcontrols let you increment, set name, and record typed events.cast burstsends1..Nincrement signals and then shows converged state.- The execution log captures mode, signal type, payload, and before/after state.