MQTT v5 Connector
Overview
Section titled “Overview”The MQTT v5 connector enables publish/subscribe messaging using the MQTT 5.0 protocol, adding shared subscriptions, user properties, and message expiry on top of MQTT v3.
Connector Types:
MqttV5Reader- Subscribe to MQTT 5.0 topicsMqttV5Writer- Publish to MQTT 5.0 topics
For MQTT 3.1.1 brokers and clients, use the MQTT v3 connector.
MQTT v5 Reader
Section titled “MQTT v5 Reader”Subscribe to a topic:
{ "type": "MqttV5Reader", "config": { "endpoint": "mqtt://localhost:1883", "topic": "sensors/temperature", "qos": 1, "clientId": "meddle-v5-reader" }}With Authentication and TLS
Section titled “With Authentication and TLS”{ "type": "MqttV5Reader", "config": { "endpoint": "mqtts://mqtt.example.com:8883", "topic": "factory/sensors/#", "qos": 1, "clientId": "meddle-v5-reader", "username": "mqtt_user", "password": "mqtt_password" }}Shared Subscription
Section titled “Shared Subscription”Distribute messages across multiple readers using sharedGroup. The connector subscribes to $share/<group>/<topic> and the broker load-balances deliveries between members:
{ "type": "MqttV5Reader", "config": { "endpoint": "mqtt://broker.example.com:1883", "topic": "factory/events", "qos": 1, "clientId": "meddle-v5-reader-1", "sharedGroup": "meddle-workers" }}MQTT v5 Writer
Section titled “MQTT v5 Writer”Publish to a topic:
{ "type": "MqttV5Writer", "config": { "endpoint": "mqtt://localhost:1883", "topic": "data/output", "qos": 1, "clientId": "meddle-v5-writer" }}Retained Message with Expiry and User Properties
Section titled “Retained Message with Expiry and User Properties”{ "type": "MqttV5Writer", "config": { "endpoint": "mqtts://mqtt.example.com:8883", "topic": "devices/state", "qos": 1, "clientId": "meddle-v5-writer", "username": "mqtt_user", "password": "mqtt_password", "retain": true, "messageExpiry": 3600, "userProperties": { "source": "meddle", "schema": "v1" } }}Configuration Parameters
Section titled “Configuration Parameters”- endpoint: Broker URL with scheme (
mqtt://host:portormqtts://host:port) - topic: Topic to subscribe or publish to (Reader supports
+and#wildcards) - qos: Quality of Service:
0,1, or2 - clientId: (Optional) Client identifier
- username: (Optional) MQTT username
- password: (Optional) MQTT password
- sharedGroup: (Reader) Shared subscription group for load balancing
- userProperties: Key/value metadata attached to messages
- retain: (Writer) Broker stores the last message and delivers it to new subscribers
- messageExpiry: (Writer) Message expiry interval in seconds
QoS Levels
Section titled “QoS Levels”- 0: At most once (fire and forget)
- 1: At least once (acknowledged delivery)
- 2: Exactly once (assured delivery)
Differences from MQTT v3
Section titled “Differences from MQTT v3”- Shared subscriptions (
sharedGroup) let multiple subscribers consume a single topic with broker-side load balancing. - User properties carry arbitrary key/value metadata per message.
- Message expiry drops undelivered messages after the configured interval.
- Reason codes on connect, subscribe, and publish provide richer error semantics handled by the underlying paho client.
Topic Wildcards (Reader Only)
Section titled “Topic Wildcards (Reader Only)”+- Single level wildcard (sensors/+/temperature)#- Multi-level wildcard (sensors/#)