MQTT配置说明
mqtt:
config:
channel1: #通道名称,可自定义,订阅消息时需要该名称
consumer-enable: true #是否开启consumer,默认开启
producer-enable: true #是否开启producer,默认开启
url: [tcp://host1:1883, tcp://host1:1883] #mqtt的url
topics: [topic1, topic2] #监听的主题,和qos一一对应
qos: [1, 0] #监听主题的qos,和主题一一对应
username: admin #用户名
password: public #密码
timeout: 60 #连接超时时间,单位:秒
kep-alive-interval: 60 #心跳时间,单位:秒
async: true #发送消息时是否异步发送
client-id-append-ip: true #是否在clientId后面追加本机ip,因为clientid是唯一值,集群环境下不能使用相同的clientid,追加ip可解决该问题
consumer-client-id: consumer_client_test1 #consumer client id配置
producer-client-id: producer_client_test1 #producer client id配置
consumer-will: #consumer遗嘱消息配置
qos: 1 #遗嘱qos
topic: will_topic #遗嘱主题
payload: '{"id": "consumer_client_test1"}' #遗嘱内容
retained: false #是否发送保留消息
producer-will: #producer遗嘱消息配置
qos: 1 #遗嘱qos
topic: will_topic #遗嘱主题
payload: '{"id": "producer_client_test1"}' #遗嘱内容
retained: false #是否发送保留消息
channel2: #通道名称,第二个配置
url: [tcp://host1:1883, tcp://host1:1883]
topics: [topic1, topic2]
qos: [1, 0]
username: admin
password: public
timeout: 60
kep-alive-interval: 60
async: true
consumer-client-id: consumer_client_test2
producer-client-id: producer_client_test2
consumer-will:
qos: 1
topic: will_topic
payload: '{"id": "consumer_client_test2"}'
retained: false
producer-will:
qos: 1
topic: will_topic
payload: '{"id": "producer_client_test2"}'
retained: false