Payload Lifecycle
This page traces the exact, step-by-step sequence a payload follows from the sending application, through the simulated network, to the receiving application โ in both PULL and PUSH mode โ plus the initialization handshake every client performs before any payload can flow, and the shutdown sequence.
Complete Payload Lifecycle (PULL Mode)โ
The four steps that move a payload from sender application โ simulated network โ receiver application:
โ AppA.send("B", data)
โโโ Comms.store(payload) โ payload_key
โโโ [SEND message: payload_key + metadata] โ Daemon
โโโ Daemon stores payload entry in TX buffer
โก SimClient.fetch()
โโโ [FETCH Request] โ Daemon
โโโ Daemon searches TX buffer
โโโ [FETCH Response: payload_key + metadata] โ Daemon
โโโ (optional) SimClient.checkOut(key) โ payload
โโโ Transmit payload through simulated network
โข SimClient.post("A", "B", payload)
โโโ Comms.store(payload) โ payload_key (if use_db)
โโโ [POST message: payload_key + metadata] โ Daemon
โโโ Daemon stores payload entry in RX buffer
โฃ AppB.receive()
โโโ [RECV Request] โ Daemon
โโโ Daemon searches RX buffer
โโโ [RECV Response: payload_key + metadata] โ Daemon
โโโ Comms.checkOut(key) โ payload
โโโ Payload available to application
Complete Payload Lifecycle (PUSH Mode)โ
In PUSH mode, the daemon proactively FORWARDs payload entries to clients. No polling is needed.
โ AppA.send("B", data)
โโโ Comms.store(payload) โ payload_key
โโโ [SEND message] โ Daemon
โโโ Daemon immediately [FORWARD]s โ SimClient.listen()
โก SimClient.listen() receives FORWARD
โโโ (optional) payload checkout from cache
โโโ Transmit payload through simulated network
โข SimClient.post("A", "B", payload)
โโโ [POST message] โ Daemon
โโโ Daemon immediately [FORWARD]s โ AppB.listen()
โฃ AppB.listen() receives FORWARD
โโโ Comms.checkOut(key) โ payload
โโโ Payload available to application
Notice the structural symmetry between the two modes โ the same four logical steps occur, but PULL mode has each client actively request ("Request" / "Response"), while PUSH mode has the daemon proactively deliver ("FORWARD"). See System Modes for when to choose each.
Initialization Handshakeโ
Before any payload can flow, each client performs a registration handshake with the daemon:
Client:
1. Construct sub-channel ports (ctrl, send, recv)
2. Open temporary connection to daemon
3. Send INIT message with: { identifier, address, ch_CTRL, ch_SEND, ch_RECV }
Daemon:
4. Parse INIT message
5. Register client in client registry
6. Construct persistent sub-channel connections to client
7. Respond with INIT message containing: { sys_mode, sim_mode, use_db, db_address, db_port, db_num }
Client:
8. Receive daemon's INIT response
9. Save configuration parameters
10. Connect to Redis cache at configured address/port
11. Ready to send/receive/fetch/post
This dynamic handshake ensures that the same configuration is understood by the daemon and all endpoints, preventing inconsistent system behavior.
Shutdownโ
Any framework component โ daemon or client โ can initiate shutdown by sending an EXIT message to the daemon. The daemon then:
- Disseminates the EXIT message throughout the system
- Tears down all transport connections
- Clients terminate their Redis connections
Go Deeperโ
- Message Flow โ the operations and status codes referenced in each step above
- Deep Architecture โ why the daemon never holds payload content, and the abstractions (
Comms,DBConnector) behindstore()/checkOut() - Protocol โ Initialization Flow โ the same handshake shown with full Protobuf message fields