MQTT

MQTT data ingestion is available using ingress of type mqtt.

Examples Repo

Example MQTT configuration files showcasing all features we will discuss can be found in our Examples Repo .

Settings

The MQTT settings in the configuration file are used to configure data ingestion from MQTT topics. Below is a detailed description of each field within the MQTT settings:

Field Required Configurable Description
serverUri true true Server URI of the MQTT server.
clientId true true Client ID.
topic true true The MQTT topic to subscribe to.
contentType false true The content type of the value, accepted types: json, recon, xml (default plaintext).

Message Structure

The message structure of received MQTT messages is (the message is just converted into a RECON value):

{ ... }

Example

The configuration below defines a PubSub ingress where JSON messages are consumed from the specified PubSub subscription and relayed to the appropriate agents for processing.

{
  "type": "mqtt",
  "settings": {
    "serverUri": "tcp://localhost:1883",
    "clientId": "nstream-jet",
    "topic": "vehicles",
    "contentType": "json"
  },
  "relay": {
    "agent": "vehicle",
    "idExtractor": "$id"
  }
}

Nstream is licensed under the Redis Source Available License 2.0 (RSALv2).