设备分享功能开发
This commit is contained in:
@ -44,7 +44,7 @@ public class MqttOutboundConfiguration {
|
||||
mqttPahoClientFactory
|
||||
);
|
||||
mqttPahoMessageHandler.setDefaultQos(1);
|
||||
mqttPahoMessageHandler.setDefaultTopic("worker/location");
|
||||
mqttPahoMessageHandler.setDefaultTopic("B/#");
|
||||
mqttPahoMessageHandler.setAsync(true);
|
||||
return mqttPahoMessageHandler;
|
||||
}
|
||||
|
@ -0,0 +1,16 @@
|
||||
package com.fuyuanshen.system.mqtt.constants;
|
||||
|
||||
|
||||
public interface MqttConstants {
|
||||
|
||||
|
||||
/**
|
||||
* 全局发布消息的key
|
||||
*/
|
||||
String GLOBAL_PUB_KEY = "B/";
|
||||
|
||||
/**
|
||||
* 全局订阅消息的key
|
||||
*/
|
||||
String GLOBAL_SUB_KEY = "A/";
|
||||
}
|
@ -27,5 +27,6 @@ public class ReceiverMessageHandler implements MessageHandler {
|
||||
String timestamp = Objects.requireNonNull(headers.get("timestamp")).toString();
|
||||
log.info("MQTT payload= {} \n receivedTopic = {} \n receivedQos = {} \n timestamp = {}"
|
||||
,payload,receivedTopic,receivedQos,timestamp);
|
||||
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user