Overview of the MQTT Collector

The MQTT collector collects data published to a topic using an MQTT broker. The data should be in Predix time series data format.

Topology: The MQTT collector supports a distributed model, that is, the MQTT broker, the collector, and Historian are installed on different machines and the data is sent to a remote Historian server. You can also install them on the same machine.

Features:
  • You can subscribe for multiple-level topics using a wildcard.
  • Only the unsolicited data collection is supported; polled collection is not supported.
  • The timestamp resolution is seconds, milliseconds, and microseconds.
  • Boolean, floating point, integer, and string data types are supported.
Note: Although the Recalculate button in Historian Administrator is enabled, the functionality is not available because the MQTT collector is a non-historic collector (the source broker does not store the historical data).
How it works:
  1. The MQTT collector connects to an MQTT broker and subscribes to a topic. Transport Layer Security (TLS) authentication is used for subscribing the data from message broker to avoid middleware attacks so that the data is securely transferred from message broker to the MQTT collector.
  2. The collector converts the data from the Predix Timeseries format to a Historian-understandabe format.
  3. It verifies whether the tag is available in Historian; if not, it will add the tag and then add the data samples, and streams the data to the Historian Server or Predix Timeseries.
Note: The MQTT collector has been validated with Predix Edge Broker, HiveMQ(v4.2.1), Mosquitto(v1.5.8).
Message format:
{
"body":
[
    {
        "attributes":{"machine_type":"<value>"},
        "datapoints":[[<value>,<value>,<value>]],
        "name":"<value>"}],
        "messageId":"<value>"}
The following table describes these parameters.
JSON Parameter Description Required/Optional
machine_type The name of the machine from which you want to collect data. Optional
datapoints Time (in epoch format), value, and quality. Required
name The tag name Required
messageId The type of the message Optional
Note: For the parameters marked optional, you need not enter values. However, you must enter the parameter names. For example:
{"body":[{"attributes":{"machine_type":" "},
"datapoints":[[1558110998983,9547909,3]],"name":"QuadInteger"}],"messageId":" "}
Supported Data Types
Source Data Type Historian Data Type
DoubleFloat, DoubleInteger, FixedByte, QuadInteger, SingleFloat ihDoubleFloat
ByteString, String ihVariableString
Boolean ihBool