Using RPC API
Using RPC API for remote calls.
Steps
- Build RPC Client
CapaRpcClient capaRpcClient = new CapaRpcClientBuilder().build();
- Invoke request
Mono<byte[]> responseMono = capaRpcClient.invokeMethod(SERVICE_APP_ID,
"hello",
"hello",
HttpExtension.POST,
null,
TypeRef.BYTE_ARRAY);
- Get invocation result
byte[] response = responseMono.block();
Explanation
- The RPC capabilities provided by CapaRpcClient require concrete implementation, as shown in the example DemoCapaHttp.
- After implementing DemoCapaHttp, it needs to be configured in capa-component-rpc.properties, and loaded through the SPI mechanism.