Merge branch 'dev-new' into dev-new-rabbitmq

# Conflicts:
#	jsowell-netty/src/main/java/com/jsowell/netty/server/yunkuaichong/NettyServerChannelInitializer.java
This commit is contained in:
Guoqs
2024-11-27 16:58:36 +08:00
12 changed files with 563 additions and 16 deletions

View File

@@ -1,6 +1,6 @@
package com.jsowell.netty.service.yunkuaichong;
import io.netty.channel.Channel;
import com.jsowell.common.core.domain.ykc.YKCDataProtocol;
import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelId;
@@ -18,6 +18,8 @@ public interface YKCBusinessService {
*/
byte[] process(byte[] msg, ChannelHandlerContext ctx);
byte[] process(YKCDataProtocol ykcDataProtocol, ChannelHandlerContext ctx);
/**
* 桩退出
* @param channelId channelId

View File

@@ -49,6 +49,20 @@ public class YKCBusinessServiceImpl implements YKCBusinessService {
return invokeStrategy.supplyProcess(ykcDataProtocol, ctx);
}
@Override
public byte[] process(YKCDataProtocol ykcDataProtocol, ChannelHandlerContext ctx) {
if (!YKCUtils.checkMsg(ykcDataProtocol)) {
// 校验不通过,丢弃消息
return null;
}
// 获取帧类型
String frameType = YKCUtils.frameType2Str(ykcDataProtocol.getFrameType());
// 获取业务处理handler
AbstractYkcHandler invokeStrategy = YKCOperateFactory.getInvokeStrategy(frameType);
// AbstractYkcHandlerV2 invokeStrategy = ykcOperateFactoryV2.getInvokeStrategy(frameType);
return invokeStrategy.supplyProcess(ykcDataProtocol, ctx);
}
@Override
public void exit(ChannelId channelId) {
// 获取桩编号