public interface HelloService {
Promise<String> sayHello(String name);
}
public class HelloServiceImpl implements HelloService {
@Override
public Promise<String> sayHello(String name) {
return Promise.of("Hello, " + name + "!");
}
}
Eventloop eventloop = Eventloop.create().withCurrentThread();
EventloopServer server = ActiveJRPCServer.create(eventloop)
.serve(HelloService.class, new HelloServiceImpl())
.listen(8080);
Eventloop eventloop = Eventloop.create().withCurrentThread();
EventloopClient client = ActiveJRPCClient.create(eventloop)
.connect(8080, "localhost")
.clientOf(HelloService.class);
Promise<String> result = client.sayHello("Alice");