Subscribe to a Topic
When an application is subscribed to a topic on an MQTT broker, it will receive any data that is published to that topic on that broker. In order to subscribe to a topic on an MQTT broker endpoint using the MQTT Protocol Adapter, you must define a block in the configuration file of type
cdpin
. The following block configuration example will subscribe to the topic input_data
on the broker located at broker.ip.com:1883
."mqtt_subscriber": {
"type": "cdpin",
"config": {
"transport_addr": "mqtt-tcp://broker.ip.com:1883",
"method": "sub",
"node_ref": "input_data",
"log_level": "info",
"log_name": "mqtt_subscribe_test"
}
}