A simple RPC framework based on Netty, ZooKeeper and Spring
Switch branches/tags
Nothing to show
Clone or download
luxiaoxun update pom
Latest commit 326ae0d Oct 21, 2018
Failed to load latest commit information.
src Update Sync tryRelease Apr 12, 2018
.gitignore Add project file for IDEA Feb 3, 2018
NettyRpc.iml update pom Oct 21, 2018
README.md Update readme Apr 13, 2018
pom.xml update pom Oct 21, 2018



An RPC framework based on Netty, ZooKeeper and Spring
中文详情:Chinese Details


  • Simple code and framework
  • Non-blocking asynchronous call and Synchronous call support
  • Long lived persistent connection
  • High availability, load balance and failover
  • Service Discovery support by ZooKeeper



How to use

  1. Define an interface:

     public interface HelloService { 
     	String hello(String name); 
     	String hello(Person person);
  2. Implement the interface with annotation @RpcService:

     public class HelloServiceImpl implements HelloService {
     	public HelloServiceImpl(){}
     	public String hello(String name) {
     		return "Hello! " + name;
     	public String hello(Person person) {
     		return "Hello! " + person.getFirstName() + " " + person.getLastName();
  3. Run zookeeper

    For example: zookeeper is running on

  4. Start server:

    Start server with spring: RpcBootstrap

    Start server without spring: RpcBootstrapWithoutSpring

  5. Use the client:

     ServiceDiscovery serviceDiscovery = new ServiceDiscovery("");
     final RpcClient rpcClient = new RpcClient(serviceDiscovery);
     // Sync call
     HelloService helloService = rpcClient.create(HelloService.class);
     String result = helloService.hello("World");
     // Async call
     IAsyncObjectProxy client = rpcClient.createAsync(HelloService.class);
     RPCFuture helloFuture = client.call("hello", "World");
     String result = (String) helloFuture.get(3000, TimeUnit.MILLISECONDS);