use of io.transport.core.protocol.message.internal.ActiveRespMessage in project transporter by wang4ever.
the class TransportMessageHandler method dispatch.
/**
* 转发给具体业务方法
*
* 【方法描述】
*
* @param msg
* @see: 【参考链接】
*/
@Override
protected void dispatch(ChannelHandlerContext ctx, Object msg) {
// 1.1 请求连接
if (msg instanceof ConnectMessage) {
if (logger.isDebugEnabled())
logger.debug("On connect. msg={}", msg);
super.processAccpetConnect(ctx, (ConnectMessage) msg);
return;
}
// 1.2 连接认证检查
this.authentication();
// 1.3 连接关闭
if (msg instanceof ClosingMessage) {
if (logger.isDebugEnabled())
logger.debug("On close. msg={}", msg);
// Close处理
super.closeClient();
return;
}
// 1.4 链路检测
if (msg instanceof ActiveMessage) {
if (logger.isDebugEnabled())
logger.debug("On Active. msg={}", msg);
// Reply client link detection.
this.echoWrite(ctx, new ActiveRespMessage());
return;
} else // 1.5 消息传送
if (msg instanceof TransportMessage) {
if (logger.isDebugEnabled())
logger.debug("On transport. msg={}", msg);
// 数据传输处理
this.processTransport(ctx, (TransportMessage) msg);
return;
} else // 1.6 注册前端设备
if (msg instanceof DeviceRegistMessage) {
if (logger.isDebugEnabled())
logger.debug("On frontend device register. msg={}", msg);
// 注册前端设备连接认证信息处理
this.processDeviceRegisted(ctx, (DeviceRegistMessage) msg);
return;
}
// 2.1 非法连接client close.
this.closeClient();
logger.warn("未知类型的消息.{}", JSON.toJSONString(msg));
return;
}
Aggregations