Publishing Data
Either Data Orchestrator or a device might publish new data on a interface/endpoint specific topic.
The topic is built using /<interface name>/<path> schema, and it is used regardless of the type of interface or mapping being used.
Also / path is a valid path for object aggregated interfaces.
The following device topics are valid:
/com.example.MyInterface/some/path/org.example.DraftInterface/otherPath/com.example.astarte.ObjectAggregatedInterface/
Data messages QoS is chosen according to mapping settings, such as reliability. Properties are always published using QoS 2.
| Interface Type | Reliability | QoS |
|---|---|---|
| properties | always unique | 2 |
| datastream | unreliable | 0 |
| datastream | guaranteed | 1 |
| datastream | unique | 2 |
Payload Format
Payload format might change according to the message type. Payloads are always BSON encoded, except for unset messages that are empty.
Property Message
Property messages have a v key (which means value). Valid examples are:
{"v": "string property value"}{"v": 10}{"v": true}
Property messages order must be preserved and they must be consumed in order. The same property with the same value can be sent several times, this behavior is allowed but discouraged: it's up to the device to avoid useless messages. A device must also make sure to publish all the properties that have been changed while the device was offline.
Unset Property Message
Properties can be unset with an unset message. An unset message is just an empty 0 bytes payload.
Datastream Message (individual aggregation)
Datastream messages for interfaces with individual aggregation have a v key and an optional t key (which means timestamp). Valid examples are:
{"v": false}{"v": 16.73}{"v": 16.73, "t": 1537449422890}
Timestamps are UTC timestamps (BSON 0x09 type), when not provided reception timestamp is used.
Datastream Message (object aggregation)
Datastream messages for interfaces with object aggregation support every Data Orchestrator payload standard field (such as "t"), but in this case value is a BSON subdocument, in which each key represent a mapping of the aggregation. Valid examples are:
{"v": {"temp": 25.3123, "hum": 67.112}}{"v": {"temp": 25.3123, "hum": 67.112}, "t": 1537452514811}
Timestamps are UTC timestamps (BSON 0x09 type), when not provided reception timestamp is used.