VLink  2.0.0
A high-performance communication middleware
mqtt_conf.h 文件参考

Transport configuration for the mqtt:// MQTT broker bridge. 更多...

此图展示该文件直接或间接的被哪些文件引用了:

浏览源代码.

详细描述

Transport configuration for the mqtt:// MQTT broker bridge.

MqttConf binds the mqtt:// URL scheme to the Eclipse Paho MQTT C client. MQTT is a lightweight publish/subscribe protocol designed for constrained devices, intermittent links, and low-bandwidth wide-area networks; it always routes through a broker (no peer-to-peer mode). Use this transport to bridge VLink topics to a cloud / fleet MQTT broker, or to interoperate with existing MQTT-based telemetry pipelines.

Supported Node Types
Publisher Subscriber Server Client Getter Setter
yes yes yes yes yes yes
URL Format
mqtt://<address>[?event=<name>&domain=<N>&qos=<0|1|2>][#<broker_uri>]
Component Description
address MQTT topic path (URL host concatenated with path)
event Optional secondary event filter (?event=)
domain Domain / namespace identifier (?domain=); factory default applied
qos MQTT QoS level 0, 1 or 2 (?qos=); factory default applied
fragment Optional broker URI override carried in the URL fragment
Broker Connection
Property Source Description
Broker URI VLINK_MQTT_BROKER env var tcp:// / ssl:// / ws:// URI
Domain ID VLINK_MQTT_DOMAIN env var Default ?domain= when absent
QoS level VLINK_MQTT_QOS env var Default 0, 1 or 2
Keep-alive (s) VLINK_MQTT_KEEPALIVE env MQTT keep-alive interval
Client ID prefix VLINK_MQTT_CLIENT_ID env Prefix used for generated client IDs
TLS Configuration
Property Description
ssl:// URI scheme Selects TLS transport instead of plain TCP
CA certificate file Configured through set_property("mqtt.ca_file", path)
Client certificate Configured through set_property("mqtt.cert_file", path)
Client private key Configured through set_property("mqtt.key_file", path)
Username / password Set via mqtt.username and mqtt.password properties
Example
// Defaults inherit broker URI and QoS from environment variables:
auto pub = vlink::Publisher<MyMsg>::create_unique("mqtt://telemetry/state?qos=1");
// Override broker URI via URL fragment:
auto sub = vlink::Subscriber<MyMsg>::create_unique("mqtt://telemetry/state#tcp://10.0.0.5:1883");
注解
Compiled only when VLINK_SUPPORT_MQTT is defined.
URL parsing uses MqttFactory::get_default_domain_id() and MqttFactory::get_default_qos() when domain or qos are omitted; direct construction defaults remain domain=0 and qos=1.
is_valid() returns false when address is empty, domain is negative, or qos is outside [0, 2].