MQTT extractor
The Cognite MQTT extractor is a generic extractor that extracts data over the MQTT protocol, connects to an MQTT broker, and subscribes to data on one or more topics. Cognite hosts the MQTT extractor, so you don't have to download or install anything.
Before you start
-
Assign access capabilities to create a hosted MQTT extractor and for the extractor to write data points, time series, events, RAW rows and in to data models in the target CDF project.
ヒントYou can use OpenID Connect and your existing identity provider (IdP) framework to manage access to CDF data securely. For more information, see setup and administration for extractors.
Deploy the extractor
-
Navigate to Data management > Integrate > Extractors.
-
Locate the Cognite MQTT extractor and select Set up extractor.
Message formats
MQTT is a generic message transport protocol agnostic to the message payloads, which can be on any format. The Cognite MQTT extractor supports several pre-defined message formats. If you want to define your own custom mapping of MQTT messages, see custom data formats for hosted extractors.
Custom formats used with MQTT jobs will receive an input
argument containing the message as JSON, and a context
argument containing the topic, for example:
{
"topic": "company/location3/machine/pressure"
}
The topic given in the context will be the actual topic the message arrived on, not the topic filter, so it can be used to distinguish identical messages arriving on different topics.
Messages are published on topics. A topic can be any string of text, but usually it's a hierarchical structure, separated by forward slashes, for example:
company/location3/machine1/pressure
Clients can subscribe to messages by subscribing to topic filters. A topic filter can be a topic written verbatim, but it also allows for wildcards such that one subscription can yield data from multiple topics. MQTT supports single-level and multi-level wildcards.
+
denotes a single-level wildcard and matches any text between two slashes. For example, if you have several topics like these:
company/location3/machine1/pressure
company/location3/machine2/pressure
company/location3/machine3/pressure
You can subscribe to all of them by subscribing to this topic filter:
company/location3/+/pressure
#
denotes a multi-level wildcard and matches any text. It has to be used at the end of the topic filter. For example, if you have several topics like the following:
company/location3/machine1/pressure
company/location3/machine2/pressure
company/location3/machine1/temperature
You can subscribe to all of them by subscribing to this topic filter:
company/location3/#