package com.dy.rtuMw.server.mqtt;
|
|
import com.dy.common.mw.protocol4Mqtt.MqttSubMsg;
|
import com.dy.common.queue.NodeObj;
|
import com.dy.common.springUtil.SpringContextUtil;
|
import com.dy.common.threadPool.ThreadPool;
|
import com.dy.common.threadPool.TreadPoolFactory;
|
import com.dy.rtuMw.web.comResult.CommandResultDeal;
|
import org.apache.logging.log4j.LogManager;
|
import org.apache.logging.log4j.Logger;
|
|
/**
|
* @Author: liurunyu
|
* @Date: 2025/6/5 15:06
|
* @Description
|
*/
|
public class MqttComResultNode implements NodeObj {
|
|
private static final Logger log = LogManager.getLogger(MqttComResultNode.class.getName());
|
|
public Object obj ;//数据
|
|
public MqttComResultNode(Object obj){
|
this.obj = obj ;
|
}
|
/**
|
* 自己处理自己
|
* @return
|
*/
|
public boolean dealSelf(){
|
try {
|
ThreadPool.Pool pool = TreadPoolFactory.getThreadPoolLong() ;
|
pool.putJob(new ThreadPool.Job() {
|
public void execute() {
|
if(obj != null){
|
if(obj instanceof MqttSubMsg){
|
CommandResultDeal deal = SpringContextUtil.getBean(CommandResultDeal.class) ;
|
deal.deal((MqttSubMsg)obj);
|
}
|
}
|
}
|
@Override
|
public void destroy(){
|
}
|
@Override
|
public boolean isDestroy(){
|
return false ;
|
}
|
|
});
|
} catch (Exception e) {
|
log.error("在RtuComResultNode内发生异常", e);
|
}
|
return true ;
|
}
|
|
|
}
|