https://github.com/wosyingjun/HRPC
A light-weight high performance RPC framework base on Netty and Zookeeper
https://github.com/wosyingjun/HRPC
Last synced: about 1 month ago
JSON representation
A light-weight high performance RPC framework base on Netty and Zookeeper
- Host: GitHub
- URL: https://github.com/wosyingjun/HRPC
- Owner: wosyingjun
- Created: 2016-08-31T08:42:21.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2016-09-03T11:08:03.000Z (almost 10 years ago)
- Last Synced: 2023-10-20T23:50:06.435Z (over 2 years ago)
- Language: Java
- Homepage:
- Size: 29.3 KB
- Stars: 144
- Watchers: 32
- Forks: 73
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- awesome-java - HRPC
README
##HRPC
>HRPC is a light-weight high performance RPC framework base on Netty and Zookeeper.
##Features
* Serialize by protostuff
* High performance, load balance and failover
* Service registration and subscription base on zookeeper
* Support asynchronous or synchronous invoking
* Keep-Alived connection, reconnect to server automatically
* Dynamic proxy by cglib
* Write less do more
* Spring support
##HRPC Structure

##Service Registry

##Server Tutorial
#####1. Spring configuration
#####2. Service interfacne
public interface UserService {
public User getUser(String phone);
public User updateUser(User user);
}
#####3. Provide rpc service
@HRPCService(UserService.class)
public class UserServiceImpl implements UserService {
@Override
public User getUser(String phone) {
User user =new User(111,"yingjun",phone);
return user;
}
@Override
public User updateUser(User user) {
user.setName("yingjun@update");
return user;
}
}
##Client Tutorial
#####1. Spring configuration
com.yingjun.rpc.service.OrderService
com.yingjun.rpc.service.UserService
com.yingjun.rpc.service.GoodsService
#####2. Synchronous invoking
UserService userService = rpcClient.createProxy(UserService.class);
User user1 = userService.getUser("188888888");
logger.info("result:" + user1.toString());
#####3. Asynchronous invoking
AsyncRPCProxy asyncProxy = rpcClient.createAsyncProxy(UserService.class);
asyncProxy.call("getUser", new AsyncRPCCallback() {
@Override
public void success(Object result) {
logger.info("result:" + result.toString());
}
@Override
public void fail(Exception e) {
logger.error("result:" + e.getMessage());
}
}, "188888888");
##Why choose protostuff ?
