All Projects → upowerman → small-rpc

upowerman / small-rpc

Licence: MIT license
🔥基于netty和hessian的一个轻量级RPC调用框架

Programming Languages

java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to small-rpc

Jupiter
Jupiter是一款性能非常不错的, 轻量级的分布式服务框架
Stars: ✭ 1,372 (+6433.33%)
Mutual labels:  netty, hessian
Pudding
Pudding 是一款迷你级分布式服务框架
Stars: ✭ 24 (+14.29%)
Mutual labels:  netty, hessian
Mango
A high-performance, open-source java RPC framework.
Stars: ✭ 150 (+614.29%)
Mutual labels:  netty, hessian
Xxl Rpc
A high performance, distributed RPC framework.(分布式服务框架XXL-RPC)
Stars: ✭ 493 (+2247.62%)
Mutual labels:  netty, hessian
Thunder
⚡️ Nepxion Thunder is a distribution RPC framework based on Netty + Hessian + Kafka + ActiveMQ + Tibco + Zookeeper + Redis + Spring Web MVC + Spring Boot + Docker 多协议、多组件、多序列化的分布式RPC调用框架
Stars: ✭ 204 (+871.43%)
Mutual labels:  netty, hessian
Netty Websocket
a fully-functioning websocket server built on netty.
Stars: ✭ 201 (+857.14%)
Mutual labels:  netty
Styx
Programmable, asynchronous, event-based reverse proxy for JVM.
Stars: ✭ 218 (+938.1%)
Mutual labels:  netty
Donkey
Modern Clojure HTTP server and client built for ease of use and performance
Stars: ✭ 199 (+847.62%)
Mutual labels:  netty
Catacumba
Asynchronous web toolkit for clojure built on top of Ratpack / Netty
Stars: ✭ 192 (+814.29%)
Mutual labels:  netty
acteur
A framework for writing lightweight, scalable servers with Guice and Netty
Stars: ✭ 66 (+214.29%)
Mutual labels:  netty
Jreactive 8583
Java Client & Server for ISO8583 & Netty
Stars: ✭ 248 (+1080.95%)
Mutual labels:  netty
Mongo Java Server
Fake implementation of MongoDB in Java that speaks the wire protocol.
Stars: ✭ 211 (+904.76%)
Mutual labels:  netty
Gopush
分布式消息推送服务,可以用于客服、推送、聊天等诸多系统的 核心组件服务!
Stars: ✭ 204 (+871.43%)
Mutual labels:  netty
Videocalling
局域网p2p视频聊天
Stars: ✭ 223 (+961.9%)
Mutual labels:  netty
Mallet
Mallet is an intercepting proxy for arbitrary protocols
Stars: ✭ 199 (+847.62%)
Mutual labels:  netty
eagle
Eagle分布式rpc调用,借助Zookeeper实现服务注册和发现,基于AQS实现高性能连接池,支持分布式追踪、监控、过载保护等配置。提供Spring和SpringBoot插件,方便与Spring和SpringBoot集成。
Stars: ✭ 77 (+266.67%)
Mutual labels:  netty
Him Netty
开源的H5即时聊天系统 spring-boot + netty + protobuf + vue ~
Stars: ✭ 194 (+823.81%)
Mutual labels:  netty
Helidon
Java libraries for writing microservices
Stars: ✭ 2,554 (+12061.9%)
Mutual labels:  netty
Fan Push
a simple and small push system for Android and server based on Netty.
Stars: ✭ 238 (+1033.33%)
Mutual labels:  netty
Mini Rpc
Spring + Netty + Protostuff + ZooKeeper 实现了一个轻量级 RPC 框架,使用 Spring 提供依赖注入与参数配置,使用 Netty 实现 NIO 方式的数据传输,使用 Protostuff 实现对象序列化,使用 ZooKeeper 实现服务注册与发现。使用该框架,可将服务部署到分布式环境中的任意节点上,客户端通过远程接口来调用服务端的具体实现,让服务端与客户端的开发完全分离,为实现大规模分布式应用提供了基础支持
Stars: ✭ 205 (+876.19%)
Mutual labels:  netty

描述:

 small-rpc 是一款基于netty+hessian的精简版的RPC  
 由于未在生产实践使用,只适合学习使用

架构简图:

image

工程结构:

        small-rpc
        ├── small-rpc-core --核心模块
        ├── small-rpc-sample --spring boot demo
        ├    ├── small-rpc-sample-springboot-api    -- 接口api jar
        ├    ├── small-rpc-sample-springboot-client -- 调用方hello world
        └──  └── small-rpc-sample-springboot-server -- 服务提供方hello world   

使用示例:

  由于目前没有上传到maven仓库  需要自行打包引入项目使用
  
  1. 下载源码进行打包 mvn clean package
  
  2. 把上述包 small-rpc-core-1.x.jar 引入项目
  
  3. provider方 配置如下:
  
      @Configuration
      public class RpcProviderConfig {

          private Logger logger = LoggerFactory.getLogger(RpcProviderConfig.class);

          // netty 端口
          @Value("${small-rpc.provider.port}")
          private int port;

          @Bean
          public RpcSpringProviderFactory rpcSpringProviderFactory() {
              // 核心类 获取服务提供类 启动netty
              RpcSpringProviderFactory providerFactory = new RpcSpringProviderFactory();
              providerFactory.setPort(port);
              providerFactory.setCorePoolSize(10);
              providerFactory.setMaxPoolSize(20);
              providerFactory.setServiceRegistryClass(LocalServiceRegistry.class);
              providerFactory.setServiceRegistryParam(Collections.EMPTY_MAP);
              return providerFactory;
          }
      }  

   4. invoker方 配置如下:
   
     @Configuration
     public class RpcInvokerConfig {
         private Logger logger = LoggerFactory.getLogger(RpcInvokerConfig.class);

         // 指定提供方地址
         @Value("${small-rpc.registry.address}")
         private String address;

         @Bean
         public RpcSpringInvokerFactory JobExecutor() {
              RpcSpringInvokerFactory invokerFactory = new RpcSpringInvokerFactory();
              invokerFactory.setServiceRegistryClass(LocalServiceRegistry.class);
              HashMap<String, String> params = new HashMap<>();
              // 指定提供方地址
              params.put(LocalServiceRegistry.DIRECT_ADDRESS, address);
              invokerFactory.setServiceRegistryParam(params);
              return invokerFactory;
         }
     }
                    
    5. 服务类需要用@RpcService 注解(服务了必须在ioc容器中)
    
    6. 消费方引用是需要注解@RpcReference 例如:
    
       @RestController
       @RequestMapping("/")
       public class HelloController {

            @RpcReference
            private HelloService helloService;

            @GetMapping("/hello")
            public HelloDTO hello(String name) {
                 return helloService.hello(name);
            }
       }

参考资料

 1.    https://github.com/TFdream/mango
 2.    https://github.com/apache/dubbo
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].