Client libraries for peer applications to communicate with The Mule orchestrator via Redis.
All communication between the orchestrator and peer containers happens through Redis. Commands use Redis lists (LPUSH from orchestrator, BLPOP from peer). Logs use Redis lists (LPUSH from peer, BLPOP from orchestrator). Status updates use a Redis string (SET from peer; the orchestrator subscribes to keyspace notifications and then GETs the value).
For a peer named alice:
| Key | Direction | Description |
|---|---|---|
alice_command |
orchestrator -> peer | Commands for the peer to execute |
alice_status |
peer -> orchestrator | Status updates from the peer |
alice_log |
peer -> orchestrator | Log entries from the peer |
The orchestrator uses Redis keyspace notifications to detect status changes instantly (no polling). On startup it runs:
CONFIG SET notify-keyspace-events K$
Each peer monitor subscribes to the channel __keyspace@0__:{peer}_status.
When a peer calls SET {peer}_status <value>, Redis publishes a notification
on that channel and the monitor fetches the new value via GET.
Log entries are drained via BLPOP {peer}_log 0 (truly blocking, no timeout).
Peer-side code does not need to do anything special for this to work — plain
SET on the status key and LPUSH on the log key is all that is required.
Commands are pipe-delimited strings pushed to {peer}_command:
| Command | Format | Description |
|---|---|---|
| connect | connect |
Join the network |
| disconnect | disconnect |
Leave the network |
| shutdown | shutdown |
Shut down the peer process |
| restart | restart|<delay_secs> |
Restart with a delay |
| peer | peer|<multiaddr> |
Add a bootstrap peer |
Any other command string is forwarded as-is for the test application to parse.
Peers receive commands by calling BLPOP {peer}_command 0 (blocking until a
command is available).
Status strings set on {peer}_status via Redis SET:
startedorstarted|<multiaddr>— peer is readyconnecting,connected,disconnecting,disconnected— network statesrestarting— about to restartstopped— peer has shut down
Log entries pushed to {peer}_log via Redis LPUSH as "level|message":
- Levels:
debug,info,warn,error - Example:
info|connected to 3 peers
All client libraries read configuration from environment variables set by the orchestrator:
| Variable | Description |
|---|---|
REDIS_URL |
Redis connection URL (e.g., redis://192.168.1.10:6399) |
PEER_NAME |
This peer's name (e.g., alice) |
LISTEN_ADDR |
Multiaddr to listen on (e.g., /ip4/0.0.0.0/udp/11984/quic-v1) |
RUST_LOG / LOG_LEVEL |
Log level filter |
To support restarts with a delay:
- Peer receives
restart|<delay>command - Peer sends
restartingstatus - Peer writes delay to
/tmp/delay - Peer exits with code 42
entrypoint.shdetects exit code 42, reads delay, sleeps, and re-runs the binary