package com.zy.acs.gateway.handler; import com.zy.acs.gateway.AbstractInboundHandler; import com.zy.acs.gateway.constant.ProtocolType; import com.zy.acs.gateway.domain.AgvPackage; import com.zy.acs.gateway.process.AgvProcessor; import io.netty.channel.ChannelHandler; import io.netty.channel.ChannelHandlerContext; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; /** * 认证处理器 * Created by vincent on 2019-04-03 */ @Component @ChannelHandler.Sharable public class AgvAuthHandler extends AbstractInboundHandler { @Autowired private AgvProcessor agvProcessor; @Override protected boolean channelRead0(ChannelHandlerContext ctx, AgvPackage pac) throws Exception { if (ProtocolType.LOGIN_REPORT.equals(pac.getHeader().getProtocolType())){ return agvProcessor.loginBus(pac, ctx.channel()); } return true; } }