openapi项目中Dubbo的调用流程

19 天前(已编辑)
15

openapi项目中Dubbo的调用流程

IxxxServiceImpl实现IxxxService并在里面注入IxxxClientService
xxxClientServiceImpl实现IxxxClientService并在里面注入生产者端的IxxxRPCService
然后通过IxxxRPCService进行Dubbo的远程调用。

Dubbo中方法调用

@Override
public EmployeeFixedSimpleDO getEmployeeBasicInfo(String companyId, String employeeId) throws ThirdClientException {
    DubboExceuteTemplate<EmployeeFixedSimpleDO> template = () -> employeeDetailRpcService.getEmployeeSimpleDO(companyId,employeeId);
    String requestInfo = "companyId:" + companyId + ",employeeId:" + employeeId;
    return template.handle(requestInfo);
}

1.创建模版对象

DubboExceuteTemplate<EmployeeFixedSimpleDO> template = () ->employeeDetailRpcService.getEmployeeSimpleDO(companyId,employeeId);

2.以字符串形式传递参数(名称:参数)

String requestInfo = "companyId:" + companyId + ",employeeId:" + employeeId;

3.调用方法并返回参数

return template.handle(requestInfo);

使用社交账号登录

  • Loading...
  • Loading...
  • Loading...
  • Loading...
  • Loading...