2025-09-11 14:29:58 +08:00
|
|
|
|
package com.hivekion.thread;
|
|
|
|
|
|
|
2025-09-19 20:20:34 +08:00
|
|
|
|
import cn.hutool.extra.spring.SpringUtil;
|
|
|
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
|
|
|
import com.hivekion.Global;
|
|
|
|
|
|
import com.hivekion.common.entity.RequestCmdInfo;
|
|
|
|
|
|
import com.hivekion.common.entity.ResponseCmdInfo;
|
|
|
|
|
|
import com.hivekion.ws.WsServer;
|
|
|
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
|
|
|
2025-09-11 14:29:58 +08:00
|
|
|
|
/**
|
|
|
|
|
|
* [类的简要说明]
|
|
|
|
|
|
* <p>
|
|
|
|
|
|
* [详细描述,可选]
|
|
|
|
|
|
* <p>
|
|
|
|
|
|
*
|
|
|
|
|
|
* @author LiDongYU
|
|
|
|
|
|
* @since 2025/7/22
|
|
|
|
|
|
*/
|
2025-09-19 20:20:34 +08:00
|
|
|
|
@Slf4j
|
2025-09-17 13:58:20 +08:00
|
|
|
|
public class HandleReceiveRunnable implements Runnable {
|
2025-09-11 14:29:58 +08:00
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
public void run() {
|
2025-09-19 20:20:34 +08:00
|
|
|
|
while (!Thread.currentThread().isInterrupted()) {
|
|
|
|
|
|
try {
|
|
|
|
|
|
|
|
|
|
|
|
RequestCmdInfo requestCmdInfo = Global.receiveCmdInfoQueue.take();
|
|
|
|
|
|
//消息分发业务bean处理
|
|
|
|
|
|
if(SpringUtil.getBean(WebsocketMsgWrapper.class) != null){
|
|
|
|
|
|
WebsocketMsgWrapper websocketMsgWrapper = SpringUtil.getBean(WebsocketMsgWrapper.class);
|
|
|
|
|
|
websocketMsgWrapper.msgHandle(requestCmdInfo.getScenarioId(),requestCmdInfo.getRoom(),requestCmdInfo.getResourceId(),requestCmdInfo.getMessage());
|
|
|
|
|
|
}else{
|
|
|
|
|
|
log.warn("==================WebsocketMsgWrapper is null==========================");
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-09-11 14:29:58 +08:00
|
|
|
|
|
2025-09-19 20:20:34 +08:00
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
|
log.error("error::", e);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2025-09-11 14:29:58 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|