日本熟妇hd丰满老熟妇,中文字幕一区二区三区在线不卡 ,亚洲成片在线观看,免费女同在线一区二区

SOFARPC API 服務

更新時間:

網關提供服務端 SOFARPC Demo 代碼供用戶下載測試,下載 API 提供者 Demo 后,SOFARPC Demo 代碼位置為:com/alipay/gateway/sofarpc/GatewayRpcServiceImpl.java。

RPC 接入配置說明(必填)

#服務實例標識,instanceId
com.alipay.instanceid=J79FOTMP8886
#acvip地址用作訂閱注冊中心
com.antcloud.antvip.endpoint=100.88.93.7
#操作員ak/sk
com.antcloud.mw.access=AC8imi57g6Ti****
com.antcloud.mw.secret=bL6QgJzDh1vuLFWftsWmoEBi1qPr****

#rpc服務端口
com.alipay.sofa.rpc.bolt-port=12200

發布服務

說明

服務可以通過注解的形式或者通過 XML 配置文件進行發布。

XML 配置形式

<bean id="gatewayRpcService" class="com.alipay.gateway.sofarpc.GatewayRpcServiceImpl"/>
    <sofa:service ref="gatewayRpcService" interface="com.alipay.gateway.facade.rpc.GatewayRpcService"
                  unique-id="rpc-test-1112">
        <sofa:binding.bolt/>
    </sofa:service>

注解形式

87.png

Demo 案例

@Service
@SofaService(bindings = {@SofaServiceBinding(bindingType = "bolt")}, uniqueId = "rpc-test-1112")
public class GatewayRpcServiceImpl implements GatewayRpcService {

    @Override
    public String hello() {
        return "hello noParamForString";
    }

    @Override
    public void testVoid(String param) {

    }

    @Override
    public void testException() throws Exception {

    }

    @Override
    public Map<String, String> noParamForMap() {
        System.out.println("rpc-test");
        Map<String, String> map = Maps.newHashMap();
        map.put("result", "noParamForMap");
        return map;
    }

    @Override
    public String simpleParam(String param) {
        return "hello simpleParamForString " + param;
    }

    @Override
    public Map<String, String> simpleParamForMap(String param) {
        Map<String, String> map = Maps.newHashMap();
        map.put("result", "simpleParamForMap " + param);
        return map;
    }

    @Override
    public String jsonParam(JSONObject param) {
        return "hello jsonParam";
    }

    @Override
    public Map<String, String> jsonParamForMap(JSONObject param) {
        Map<String, String> map = Maps.newHashMap();
        map.put("result", "jsonParamForMap");
        return map;
    }

    @Override
    public User jsonParamForUser(User user) {
        return user;
    }

    @Override
    public List<String> listNoParam() {
        List<String> list = new ArrayList<>();
        list.add("aaa");
        return list;
    }

    @Override
    public List<User> listSimpleParam(List<User> list) {
        return list;
    }

    @Override
    public String registryQuestionTest() throws UnknownHostException {
        return JSONObject.toJSONString(InetAddress.getLocalHost());
    }

    @Override
    public User user1(User user) {
        return user;
    }

    @Override
    public User user2(String name) {
        User user = new User(name, 20);
        return user;
    }

    @Override
    public AccountQueryResult queryAccountBalance(String accountNo) {

        AccountQueryResult accountQueryResult = new AccountQueryResult();
        Account account = new Account(accountNo, new BigDecimal(11111111), new BigDecimal(22222222), new BigDecimal(33333333));
        accountQueryResult.setSuccess(true);
        accountQueryResult.setAccount(account);
        accountQueryResult.setMsgCode("200");
        accountQueryResult.setMsgText("success");

        return accountQueryResult;
    }
}