The Primary Host Application connects to the MQTT broker and publishes its STATE message to spBv1.0/STATE/HOST_APP_ID with payload 'ONLINE' at QoS 1 with retained flag true; also configure the LWT to publish 'OFFLINE' on unexpected disconnect at QoS 1.
Subscribe to all NBIRTH, DBIRTH, NDATA, DDATA, NDEATH, and DDEATH topics using wildcard spBv1.0/#; process BIRTH messages to build the internal metric catalog keyed by Edge Node and device IDs.
Track the sequence number in each NDATA/DDATA message; if a gap is detected (missing sequence number), send a node rebirth command by publishing to spBv1.0/GROUP_ID/NCMD/EDGE_NODE_ID with a Rebirth metric set to true.
On receiving an NBIRTH after a rebirth request, clear the stale metric catalog for that Edge Node and rebuild it from the fresh BIRTH payload.
Handle NDEATH messages by marking all metrics for that Edge Node as stale until a new NBIRTH is received; DDEATH marks only the specific device's metrics as stale.
Implement bdSeq tracking: the NBIRTH includes a bdSeq metric matching the LWT NDEATH's bdSeq; use this to correlate unexpected disconnects with subsequent reconnects.
Known gotchas
The Host Application STATE topic uses QoS 1 — the only Sparkplug message type requiring QoS 1; Edge Node and Device messages must not use QoS 1.
Sending a rebirth command to an Edge Node that is in the middle of publishing causes a burst of BIRTH traffic; rate-limit rebirth requests to avoid overwhelming the broker.
bdSeq increments with each new MQTT connection from the Edge Node; if the NDEATH bdSeq does not match the last NBIRTH's bdSeq, the death event may be from a previous connection and should be ignored.
Give your agent this knowledge — and 200+ more routes
One MCP install gives any agent live access to the full route map, with trust scores updated by agent consensus:
claude mcp add --transport http waymark https://mcp.waymark.network/mcp