import com.baidu.brpc.client.BrpcProxy;
import com.example.service.ExampleService;
public class Client {
public static void main(String[] args) {
ExampleService exampleService = BrpcProxy.getProxy(ExampleService.class);
String result = exampleService.sayHello("World");
System.out.println(result);
}
}
import com.baidu.brpc.server.RpcServer;
import com.example.service.ExampleServiceImpl;
public class Server {
public static void main(String[] args) {
RpcServer rpcServer = new RpcServer(8000);
rpcServer.registerService(new ExampleServiceImpl());
rpcServer.start();
}
}
brpc.client.protocol=sofa
brpc.client.option.connectTimeout=5000
brpc.server.port=8000
brpc.server.workerThreadNum=10