1. 增加 XXL-Job starter

2. 迁移 pay 服务的 Job 逻辑
This commit is contained in:
YunaiV
2020-11-30 18:47:57 +08:00
parent 04f53da686
commit efaeb5b39d
50 changed files with 655 additions and 439 deletions

View File

@@ -0,0 +1,49 @@
package cn.iocoder.mall.payservice.common.dubbo;
import cn.iocoder.common.framework.vo.CommonResult;
import org.apache.dubbo.config.ApplicationConfig;
import org.apache.dubbo.config.ReferenceConfig;
import org.apache.dubbo.config.RegistryConfig;
import org.apache.dubbo.rpc.service.GenericService;
import java.util.Map;
public class DubboGenericInvokerTest {
public static void main(String[] args) {
ApplicationConfig application = new ApplicationConfig();
application.setName("api-generic-consumer");
RegistryConfig registry = new RegistryConfig();
registry.setAddress("nacos://400-infra.server.iocoder.cn:8848?namespace=dev");
application.setRegistry(registry);
ReferenceConfig<GenericService> reference = new ReferenceConfig<>();
// 弱类型接口名
reference.setInterface("cn.iocoder.mall.tradeservice.rpc.order.TradeOrderRpc");
reference.setVersion("1.0.0");
// 声明为泛化接口
reference.setGeneric(true);
reference.setApplication(application);
// 用com.alibaba.dubbo.rpc.service.GenericService可以替代所有接口引用
GenericService genericService = reference.get();
Object result = genericService.$invoke("updateTradeOrderPaySuccess",
new String[]{String.class.getName(), Integer.class.getName()},
new Object[]{"1", 100});
CommonResult<Boolean> commonResult = parseCommonResult((Map<String, Object>) result);
System.out.println(result);
}
private static CommonResult<Boolean> parseCommonResult(Map<String, Object> dubboResult) {
CommonResult<Boolean> commonResult = new CommonResult<>();
commonResult.setCode((Integer) dubboResult.get("code"));
commonResult.setMessage((String) dubboResult.get("message"));
commonResult.setData((Boolean) dubboResult.get("data"));
return commonResult;
}
}

View File

@@ -0,0 +1 @@
package cn.iocoder.mall.payservice.common;