Polling, subscriptions, and state reconciliation
Polling and subscriptions provide different views of system changes. Plan gap detection and state reconciliation so the application can recover after missed events.
Sources and scopeSource record 25 August 2026
Technical source record: 25 August 2026. Check the linked documentation for current product requirements.
Protocol neutral state reconciliation pattern; snapshot consistency, sequence, subscription, replay, and retention guarantees are protocol and product specific.
On this page
Overview#
Polling gives periodic snapshots; subscriptions give changes. Neither alone guarantees a complete current state. Events can be lost, duplicated or reordered, while snapshots can be stale, expensive or internally inconsistent.
State record#
Store value, source, source native identifier, observation time, ingestion time, sequence/revision where supplied, quality/confidence, freshness deadline and the configuration/profile version used to interpret it. Unknown and stale must remain distinct from a legitimate false, closed, inactive or zero value.
Bootstrap pattern#
- Establish authenticated session and capability/version context.
- Start or prepare the event subscription without discarding early events.
- Obtain a consistent snapshot or mark its consistency limitation.
- Merge buffered events newer than the snapshot boundary.
- Publish state only after provenance and freshness are known.
- Periodically reconcile with authoritative snapshots and inventory.
When the protocol can't provide a revision or atomic boundary, document the race and use conservative unknown/transitional state rather than claiming certainty.
Polling discipline#
- Add jitter to avoid synchronised fleets.
- Bound concurrency, response size and per device work.
- Distinguish unsupported, denied, offline, timeout, invalid response and stale cache.
- Adapt cadence to operational need without hiding failures.
- Don't poll an actuation endpoint to infer whether a command was authorised or physically completed unless the returned state is explicitly authoritative.
Subscription discipline#
- Track subscription identity, lease/expiry, filters and negotiated schema.
- Renew before expiry with bounded retry and visible failure.
- Deduplicate by stable event identity or carefully scoped composite key.
- Reconcile after reconnect, peer restart, sequence gap or queue loss.
- Persist only the offset/token semantics the protocol guarantees.
Environment evidence#
- Cite the exact snapshot, sequence, subscription, lease, replay, and retention guarantees used by the implementation.
- Cover bootstrap races, duplicate/reordered events, sequence gaps, lease expiry, reconnect, peer restart, stale snapshots, and partial inventory.
- Record protocol/product versions, configuration, synthetic case set, observed state transitions, unresolved races, and reconciliation limits.