配置 SOFA_TR API 服务前需单独 下载 SOFA_TR Demo,SOFA_TR Demo 接口位置为:com/alipay/gateway/sofarpc/tr/SofaTrWeightRouterNoCrossServiceImpl.java。
说明
在网关控制台上配置 SOFA_TR 类型的 API 需要联系蚂蚁技术支持团队开通权限。
SOFA_TR API 接入配置说明(必填)
#服务实例标识,instanceId
com.alipay.instanceid=J79FOTMP8886
#acvip地址用作订阅注册中心
com.antcloud.antvip.endpoint=100.88.93.7
#操作员ak/sk
com.antcloud.mw.access=AC8imi57g6TiRr9u
com.antcloud.mw.secret=bL6QgJzDh1vuLFWftsWmoEBi1qPrzwQz
#rpc_tr服务端口
rpc_tr_port=12202
rpc_tr_negotiation_enable=false
发布服务
说明
服务可以通过 XML 配置文件进行发布。
XML 配置形式
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:sofa="http://schema.alipay.com/sofa/schema/service"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://schema.alipay.com/sofa/schema/service http://schema.alipay.com/sofa/sofa-service-4-0-0.xsd"
default-autowire="byName">
<sofa:service ref="sofaTrWeightRouterNoCrossService" interface="com.alipay.gateway.facade.rpc.SofaTrWeightRouterNoCrossService" unique-id="com.test.unique.id">
<sofa:binding.tr>
<sofa:global-attrs timeout="70000" />
</sofa:binding.tr>
</sofa:service>
</beans>
Demo案例
@Service
public class SofaTrWeightRouterNoCrossServiceImpl implements SofaTrWeightRouterNoCrossService {
@Override
public String hello() {
return "currentTimeMillis: " + System.currentTimeMillis();
}
}
public interface SofaTrWeightRouterNoCrossService {
String hello();
}
反馈
- 本页导读 (0)
文档反馈