虎虎虎虎
parent
c3aee00eff
commit
08aec277e6
|
@ -86,11 +86,23 @@ public class MqttMonitor {
|
|||
|
||||
@Override
|
||||
public void messageArrived(String topic, MqttMessage mqttMessage) {
|
||||
log.info("消息已送达");
|
||||
log.info("接收消息主题:{}",topic);
|
||||
log.info("接收消息qos:{}", mqttMessage.getQos());
|
||||
// log.info("消息已送达");
|
||||
// log.info("接收消息主题:{}",topic);
|
||||
// log.info("接收消息qos:{}", mqttMessage.getQos());
|
||||
|
||||
//接收到的原始报文
|
||||
String message = new String(mqttMessage.getPayload());
|
||||
|
||||
log.info("接收消息原始内容:{}", message);
|
||||
|
||||
//去除空格 得到16进制字符串
|
||||
String replaced = message.replaceAll(" ", "");
|
||||
log.info("接收消息剪切后内容:{}", replaced);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
log.info("接收消息内容:{}", new String(mqttMessage.getPayload()));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Reference in New Issue