MQTT消费
This commit is contained in:
parent
2e03d0780c
commit
84b0106cc7
@ -23,11 +23,11 @@ public class CommonApiImpl implements CommonApi {
|
|||||||
try {
|
try {
|
||||||
String str = JSON.toJSONString(obj);
|
String str = JSON.toJSONString(obj);
|
||||||
mqttUtils.pub(topic, JSON.toJSONString(obj));
|
mqttUtils.pub(topic, JSON.toJSONString(obj));
|
||||||
if (str.length() > 510) {
|
/*if (str.length() > 510) {
|
||||||
log.info("MQTT消息发送成功topic :{}, 内容 :{}",topic, str.substring(0, 500));
|
log.info("MQTT消息发送成功topic :{}, 内容 :{}",topic, str.substring(0, 500));
|
||||||
}else {
|
}else {
|
||||||
log.info("MQTT消息发送成功topic :{}, 内容 :{}",topic, str);
|
log.info("MQTT消息发送成功topic :{}, 内容 :{}",topic, str);
|
||||||
}
|
}*/
|
||||||
} catch (MqttException e) {
|
} catch (MqttException e) {
|
||||||
log.info("MQTT消息发送异常 :{}",e);
|
log.info("MQTT消息发送异常 :{}",e);
|
||||||
}
|
}
|
||||||
@ -37,11 +37,11 @@ public class CommonApiImpl implements CommonApi {
|
|||||||
public void commonMethodStr(String str, String topic) {
|
public void commonMethodStr(String str, String topic) {
|
||||||
try {
|
try {
|
||||||
mqttUtils.pub(topic, str);
|
mqttUtils.pub(topic, str);
|
||||||
if (str.length() > 510) {
|
/*if (str.length() > 510) {
|
||||||
log.info("MQTT消息发送成功topic :{}, 内容 :{}",topic, str.substring(0, 500));
|
log.info("MQTT消息发送成功topic :{}, 内容 :{}",topic, str.substring(0, 500));
|
||||||
}else {
|
}else {
|
||||||
log.info("MQTT消息发送成功topic :{}, 内容 :{}",topic, str);
|
log.info("MQTT消息发送成功topic :{}, 内容 :{}",topic, str);
|
||||||
}
|
}*/
|
||||||
} catch (MqttException e) {
|
} catch (MqttException e) {
|
||||||
log.info("MQTT消息发送异常 :{}",e);
|
log.info("MQTT消息发送异常 :{}",e);
|
||||||
}
|
}
|
||||||
|
@ -22,7 +22,7 @@ public class RobotStatusServiceImpl implements MqttService {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void analysisMessage(String message) {
|
public void analysisMessage(String message) {
|
||||||
log.info("处理RobotStatusServiceImpl的消息 :{}", message);
|
// log.info("处理RobotStatusServiceImpl的消息 :{}", message);
|
||||||
RobotPoseStatusDTO robotStatusData = JSON.parseObject(message, RobotPoseStatusDTO.class);
|
RobotPoseStatusDTO robotStatusData = JSON.parseObject(message, RobotPoseStatusDTO.class);
|
||||||
robotStatusApi.robotStatusUpdate(robotStatusData);
|
robotStatusApi.robotStatusUpdate(robotStatusData);
|
||||||
}
|
}
|
||||||
|
@ -47,7 +47,7 @@ public class RobotStatusApiImpl implements RobotStatusApi {
|
|||||||
@Resource
|
@Resource
|
||||||
private RequestProcessor processor;
|
private RequestProcessor processor;
|
||||||
|
|
||||||
private static final ExecutorService executorService = Executors.newFixedThreadPool(20);
|
private static final ExecutorService executorService = Executors.newFixedThreadPool(50);
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private CommonApi commonApi;
|
private CommonApi commonApi;
|
||||||
|
Loading…
Reference in New Issue
Block a user