Skip to main content

MQTT Client Collector

A pre-built microservice designed to easily integrate with data sources that publish information via the MQTT protocol.

This blueprint is perfect for scenarios where your data provider or IoT devices send real-time updates to an MQTT broker. Instead of developing a custom collector from scratch, you can deploy and configure this reusable component to automatically receive these messages and forward them into the Open Data Hub pipeline.

What is the MQTT Listener?

The MQTT Listener is a specialized data collector that acts as a subscriber to an MQTT broker. It listens for messages on a specified MQTT topic, captures the raw payload of these messages, and then publishes this raw data to an internal Open Data Hub message queue (RabbitMQ). From there, the data can be picked up by a transformer for further processing and standardization.

This collector operates on a "listen" model, meaning it continuously waits for new messages on the configured MQTT topic.

Key Features

  • MQTT Subscription: Connects to an MQTT broker and subscribes to a defined topic.
  • Real-time Data Capture: Captures message ID, topic, and payload from incoming MQTT messages.
  • Raw Data Forwarding: Publishes the raw MQTT message content directly to an Open Data Hub message queue (RabbitMQ).
  • Configurable Credentials: Supports MQTT username/password authentication.
  • Flexible Routing: Allows configuration of RabbitMQ exchange and routing keys.

How to Configure the MQTT Listener

Configuring the MQTT Listener is primarily done through environment variables. This allows for easy deployment and management across different environments (development, testing, production) without modifying the code.

You will typically configure these variables in your deployment setup (e.g., in a .env file for local development, or in Helm charts for Kubernetes deployments).

Common Environment Variables

These variables are standard across many Open Data Hub collectors and define logging and basic messaging behavior.

Variable NameDescriptionExample Value
LOG_LEVELThe minimum logging level (e.g., DEBUG, INFO, WARN, ERROR).INFO
MQ_EXCHANGEThe RabbitMQ exchange where raw data messages will be published.ingress
MQ_CLIENTA unique identifier for this collector client, used by RabbitMQ for connection naming.dc-mqtt-client-dev
PROVIDERA unique identifier for the data source this collector is handling (e.g., source-name/dataset-name). This will be part of the raw data metadata.test/mqtt

MQTT-Specific Environment Variables

These variables are unique to the MQTT Listener and define its connection to your MQTT broker.

Variable NameDescriptionExample Value
MQTT_URIThe URI of your MQTT broker (e.g., tcp://broker.example.com:1883 or ssl://broker.example.com:8883).xsona-broker.axians.it:8883
MQTT_USERThe username for connecting to the MQTT broker.my_mqtt_user
MQTT_PASSThe password for connecting to the MQTT broker.my_mqtt_password
MQTT_CLIENTIDA unique client ID for this MQTT subscriber.airQuinoLinearizationDev
MQTT_TOPICThe MQTT topic to subscribe to for incoming messages.AirQuino/RawData