使用RPC API
使用RPC API进行远程调用.
步骤
- 构建 RPC Client
CapaRpcClient capaRpcClient = new CapaRpcClientBuilder().build();
- 调用请求
Mono<byte[]> responseMono = capaRpcClient.invokeMethod(SERVICE_APP_ID,
"hello",
"hello",
HttpExtension.POST,
null,
TypeRef.BYTE_ARRAY);
- 获取调用结果
byte[] response = responseMono.block();
解释
- CapaRpcClient 提供的 RPC 能力,需要具体实现,如示例 DemoCapaHttp 。
- 实现后的DemoCapaHttp,需要在 capa-component-rpc.properties 中进行配置,通过SPI机制实现加载。
Feedback
Was this page helpful?
Glad to hear it! Please tell us how we can improve.
Sorry to hear that. Please tell us how we can improve.
最后修改 01.06.2022: docs: refactor (f7fe0e0)