|
@@ -4,6 +4,9 @@ import com.evp.app.common.xnet.NettyUtils;
|
|
|
import com.evp.comm.server.common.SpringUtils;
|
|
|
import com.evp.comm.server.config.ApplicationConfig;
|
|
|
import com.evp.comm.server.dto.EvpsCenter;
|
|
|
+import com.evp.comm.server.entity.TbRegionCenterComm;
|
|
|
+import com.evp.comm.server.process.dbms.DbmsData;
|
|
|
+import com.evp.comm.server.process.dbms.DbmsDataProcess;
|
|
|
import com.evp.comm.server.repository.ApplicationRepository;
|
|
|
import com.evp.comm.server.xnet.server.codec.EvpSendByteBufMessageEncoder;
|
|
|
import com.evp.comm.server.xnet.server.handler.EvpCommServerInboundMessageHandler;
|
|
@@ -24,10 +27,12 @@ public class EvpCommServerInitializer extends ChannelInitializer<Channel> {
|
|
|
private final EvpSendByteBufMessageEncoder evpSendByteBufMessageEncoder;
|
|
|
private final ApplicationConfig config;
|
|
|
private final ApplicationRepository appRepository;
|
|
|
+ private final DbmsDataProcess dbmsDataProcess;
|
|
|
|
|
|
- public EvpCommServerInitializer(ApplicationConfig config, ApplicationRepository applicationRepository) {
|
|
|
+ public EvpCommServerInitializer(ApplicationConfig config, ApplicationRepository applicationRepository, DbmsDataProcess dbmsDataProcess) {
|
|
|
this.config = config;
|
|
|
this.appRepository = applicationRepository;
|
|
|
+ this.dbmsDataProcess = dbmsDataProcess;
|
|
|
this.evpCommServerInboundMessageHandler = SpringUtils.getBean(EvpCommServerInboundMessageHandler.class);
|
|
|
this.evpSendByteBufMessageEncoder = SpringUtils.getBean(EvpSendByteBufMessageEncoder.class);
|
|
|
}
|
|
@@ -53,6 +58,12 @@ public class EvpCommServerInitializer extends ChannelInitializer<Channel> {
|
|
|
channel.close();
|
|
|
}
|
|
|
|
|
|
+ TbRegionCenterComm stts = TbRegionCenterComm.builder()
|
|
|
+ .centerId(center.getCenterId())
|
|
|
+ .commState(TbRegionCenterComm.CENTER_COMM_START)
|
|
|
+ .build();
|
|
|
+ this.dbmsDataProcess.add(new DbmsData(DbmsData.DBMS_DATA_CENTER_STTS, center, stts));
|
|
|
+
|
|
|
center.getNetState().connect(channel);
|
|
|
channel.attr(ApplicationRepository.SIG_REGION_ATTRIBUTE_KEY).set(center);
|
|
|
|
|
@@ -61,12 +72,13 @@ public class EvpCommServerInitializer extends ChannelInitializer<Channel> {
|
|
|
pipeline.addLast(new LoggingHandler(LogLevel.INFO));
|
|
|
pipeline.addLast("idleStateHandler", idleStateHandler);
|
|
|
pipeline.addLast("frameDecoder", new LengthFieldBasedFrameDecoder(
|
|
|
- EvpsProtocolConst.EVPS_MAX_PACKET *2,
|
|
|
+ EvpsProtocolConst.EVPS_MAX_PACKET *4,
|
|
|
EvpsProtocolConst.EVPS_PACKET_LENGTH_FIELD_OFFSET, /* 패킷 에서 길이 필드의 시작 위치 */
|
|
|
EvpsProtocolConst.EVPS_PACKET_LENGTH_FIELD_SIZE, /* 길이 필드의 크기 */
|
|
|
EvpsProtocolConst.EVPS_PACKET_LENGTH_ADJUSTMENTS, /* 길이 필드 값에 +-해서 길이 필드 이후의 전체 길이를 구한다 */
|
|
|
0));
|
|
|
pipeline.addLast("packetInboundHandler", this.evpCommServerInboundMessageHandler);
|
|
|
pipeline.addLast("frameEncoder", this.evpSendByteBufMessageEncoder);
|
|
|
+
|
|
|
}
|
|
|
}
|