1. 增加Netty主动发送数据功能
This commit is contained in:
parent
48847965c1
commit
cf42bfe56c
|
@ -1,6 +1,7 @@
|
|||
package com.zjyr.beidouservice.adapter.impl.netty;
|
||||
|
||||
import com.zjyr.beidouservice.misc.HelperUtils;
|
||||
import com.zjyr.beidouservice.pojo.vo.ControlAdapterSocketCtx;
|
||||
import com.zjyr.beidouservice.pojo.vo.YuanRongBinProtocol;
|
||||
import io.netty.channel.ChannelHandler;
|
||||
import io.netty.channel.ChannelHandlerContext;
|
||||
|
@ -10,11 +11,15 @@ import lombok.RequiredArgsConstructor;
|
|||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
@Slf4j
|
||||
@Component
|
||||
@ChannelHandler.Sharable
|
||||
@RequiredArgsConstructor
|
||||
public class MessageHandler extends SimpleChannelInboundHandler<YuanRongBinProtocol> {
|
||||
public static ConcurrentHashMap<Long, ControlAdapterSocketCtx> ctxMap = new ConcurrentHashMap<>();
|
||||
|
||||
@Override
|
||||
public void userEventTriggered(ChannelHandlerContext ctx, Object evt) throws Exception {
|
||||
log.info("{}:: Trigger Heart Signle", ctx.channel().id());
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
package com.zjyr.beidouservice.pojo.vo;
|
||||
|
||||
import io.netty.channel.ChannelHandlerContext;
|
||||
import lombok.Data;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
||||
@Data
|
||||
@RequiredArgsConstructor
|
||||
public class ControlAdapterSocketCtx {
|
||||
private Long controlAdapterId;
|
||||
private ChannelHandlerContext ctx;
|
||||
}
|
Loading…
Reference in New Issue