Distributed Publish & Subscribe for IoT
Retained Publications


If there are no subscribers for the topic strings in a publication the publication will be discarded, typically at the first hop.

There are use cases where it is desirable for a publication to be held for later delivery. MQTT has a feature that supports this use case; if an MQTT publication is flagged as "retained" the MQTT broker holds onto the publication until a subscriber is available to consume the message. DPS implements a similar feature where a TTL (time-to-live) can be set on a publication which is then held for delivery up until the time the TTL expires. For a publication to be retained it must match a subscription somewhere in the network, this allows specific nodes to take on responsibility for retaining matching publications. A retained publication can be replaced if the publisher sends a new publications having the same UUID but a later serial number. A retained publication can be explicitly expired by sending a new publication with the same UUID and a negative TTL.

Retained publications provide support for sleepy nodes, that is, nodes that are only periodically active on the network. For example, a wireless sensor node publishes a telemetry reading in the payload of a retained publication with a ten minute TTL then drops into low power mode waking within ten to deliver the next reading. The most recent telemetry will be available to subscribers no matter when they join the network. Similarly a sleepy subscriber can periodically connect to the network to receive publications updates.