实现一个基于netty单路复用网络模型的rpc框架,支持spring-boot启动,支持zookeeper,nacos注册中心。
public interface ExampeService {
ResponseDTO doRun(RequestDTO requestDTO);
}
配置application.properties
krpc.registeredPath = nacos://114.116.3.221:8848
@KrpcResource(version = "1.0.1",timeout = 1000)
private ExampeService exampeService;
配置application.properties
krpc.registeredPath = nacos://114.116.3.221:8848
krpc.port = 8082
@KrpcService(version = "1.0.1")
public class ExampeServiceImpl implements ExampeService {
@Override
public ResponseDTO doRun(RequestDTO requestDTO) {
ResponseDTO responseDTO = new ResponseDTO();
responseDTO.setDate(new Date(requestDTO.getDate().getTime() + (long) requestDTO.getNum() * 60 * 60 * 1000));
return responseDTO;
}
}