1. 网络接收事件增加taskId参数

This commit is contained in:
HuangXin 2023-08-20 12:23:12 +08:00
parent b3e9b79d98
commit 28c904076a
2 changed files with 11 additions and 0 deletions

View File

@ -53,6 +53,7 @@ public class MessageHandler<T> extends SimpleChannelInboundHandler<BaseBinaryPro
public void channelRead0(ChannelHandlerContext ctx, BaseBinaryProtocol<T> message) throws Exception {
SocketNotifyEvent notify = new SocketNotifyEvent(this,
ctx.channel(),
message.getCommandId(),
SocketEventName.SOCKET_EVT_RECV,
message.getMsgContent().getMsgBody());
applicationEventPublisher.publishEvent(notify);

View File

@ -12,6 +12,7 @@ import org.springframework.context.ApplicationEvent;
@Setter
@Getter
public class SocketNotifyEvent extends ApplicationEvent {
private int taskId;
/**
* The Evt message.
*/
@ -33,10 +34,19 @@ public class SocketNotifyEvent extends ApplicationEvent {
* @param evtType the evt type
* @param evtMessage the evt message
*/
public SocketNotifyEvent(Object source, Channel ctx, int taskId, SocketEventName evtType, Object evtMessage) {
super(source);
this.socketEvent = evtType;
this.evtMessage = evtMessage;
this.ctxChannel = ctx;
this.taskId = taskId;
}
public SocketNotifyEvent(Object source, Channel ctx, SocketEventName evtType, Object evtMessage) {
super(source);
this.socketEvent = evtType;
this.evtMessage = evtMessage;
this.ctxChannel = ctx;
this.taskId = 0;
}
}