A simple rpc framework.

Related tags

Microservice werpc
Overview

werpc 微RPC

介绍

A simple rpc framework —— werpc.

RPC(Remote Procedure Call):远程过程调用,像调用本地方法一样调用远程过程。采用Client-Server结构,通过request-response消息模式实现。
RPC框架就是指封装好了参数编组、消息解组、底层网络通信的RPC程序开发框架,可以在这个框架的基础上只需专注与业务代码的编写。 常见rpc实现:

  • RMI,Remote method invocation,远程方法调用是oop领域中rpc的一种具体实现
  • webservice + xml
  • restful接口调用(http+json)
  • ...

RPC流程

  1. 客户端处理过程中调用Client stub(就像代用本地方法一样),传入参数;
  2. Client stub 将参数编织为消息,通过网络向服务端发送消息;
  3. 服务端Server stub 接收请求消息,解组消息为参数;
  4. Server stub再调用服务端的过程,过程执行结果以反方向的相同步骤响应给客户端

RPC结构

  • 注册中心
    服务注册与发现,可以使用zookeeper、nacos等作为服务的注册中心,服务端向注册中心注册服务,客户端从服务端发现服务(获取服务信息,如服务器地址等)。
  • 服务端
    提供服务,有服务接口的具体实现,使用反射调用具体实现(stub)
  • 客户端
    获取服务,实现负载均衡策略,调用服务,通过动态代理的方式将网络传输细节封装起来(stub)。
  • 序列化与反序列化
    网络传输必然离不开序列化与反序列化,常见的序列化方式有:XML、JSON、Protobuf、Thrift、hessian、kryo、Avro等

使用

默认使用Nacos作为注册中心,所以使用是需确保Nacos已经启动,并且端口为8848

1.服务端
引入werpc-api、 werpc-api模块
初始化Server(可以使用SocketServer 或 NettyServer),设置Server初始化参数
实现公共接口,并且使用@WeRpcService注解实现类

2.客户端
引入werpc-api、 werpc-api模块
创建RPC客户端、动态代理器
动态代理对象调用服务

先启动服务端,在启动客户端 具体见werpc-test-server、 werpc-test-client

You might also like...

Opinionated libraries for HTTP&JSON-based RPC using Retrofit, Feign, OkHttp as clients and Jetty/Jersey as servers

Conjure Java Runtime (formerly http-remoting) This repository provides an opinionated set of libraries for defining and creating RESTish/RPC servers a

Dec 13, 2022

The Java gRPC implementation. HTTP/2 based RPC

gRPC-Java - An RPC library and framework gRPC-Java works with JDK 7. gRPC-Java clients are supported on Android API levels 16 and up (Jelly Bean and l

Jan 1, 2023

Distributed and fault-tolerant realtime computation: stream processing, continuous computation, distributed RPC, and more

IMPORTANT NOTE!!! Storm has Moved to Apache. The official Storm git repository is now hosted by Apache, and is mirrored on github here: https://github

Dec 26, 2022

✈A high-performance RPC based on Java & Netty.

bRPC README 中文版本 一个基于netty的RPC框架 基于netty NIO、IO多路复用。 client与server端建立心跳包保活机制。发生未知断连时,重连保证可靠长连接。 使用kryo序列化,自定义传输包,及传输格式,避免TCP沾包问题。 支持zookeeper或nacos做服务

Dec 16, 2022

Lightweight service-based PubSub, RPC and public APIs in Java

kite - service-based RPC, public APIs and PubSub in Java kite is a collection of reactive application messaging libraries that aim at providing high l

Feb 17, 2022

A base repo for creating RPC microservices in Java with gRPC, jOOQ, and Maven.

Wenower Core OSX local installation Install Protocol Buffer $ brew install protobuf Install Postgresql and joopc database and user $ brew install pos

Jan 9, 2022

A fault tolerant, protocol-agnostic RPC system

A fault tolerant, protocol-agnostic RPC system

Finagle Status This project is used in production at Twitter (and many other organizations), and is being actively developed and maintained. Releases

Jan 4, 2023

Apache Thrift is a lightweight, language-independent software stack for point-to-point RPC implementation

Apache Thrift is a lightweight, language-independent software stack for point-to-point RPC implementation

Apache Thrift Introduction Thrift is a lightweight, language-independent software stack for point-to-point RPC implementation. Thrift provides clean a

Jan 4, 2023

CustomRPC - a tool that allows you to change your discord rich presence (RPC) to a custom one

CustomRPC is a tool that allows you to change your discord rich presence (RPC) to a custom one. It also allows creating sentence sequences

May 3, 2022

Google Mr4c GNU Lesser 3 Google Mr4c MR4C is an implementation framework that allows you to run native code within the Hadoop execution framework. License: GNU Lesser 3, .

Introduction to the MR4C repo About MR4C MR4C is an implementation framework that allows you to run native code within the Hadoop execution framework.

Dec 9, 2022

Lattice is a powerful, lightweight business extension invoke framework. By using the Lattice framework, complex business customization can be efficiently organized and managed.

Lattice Framework Introduction Lattice is a powerful, lightweight business extension invoke framework. By using the Lattice framework, complex busines

Dec 30, 2022

The simple, stupid batch framework for Java

The simple, stupid batch framework for Java

Easy Batch The simple, stupid batch framework for Java™ Project status As of November 18, 2020, Easy Batch is in maintenance mode. This means only bug

Dec 29, 2022

Rest.li is a REST+JSON framework for building robust, scalable service architectures using dynamic discovery and simple asynchronous APIs.

Rest.li is a REST+JSON framework for building robust, scalable service architectures using dynamic discovery and simple asynchronous APIs.

Rest.li is an open source REST framework for building robust, scalable RESTful architectures using type-safe bindings and asynchronous, non-blocking I

Dec 29, 2022

A simple expressive web framework for java. Spark has a kotlin DSL https://github.com/perwendel/spark-kotlin

Spark - a tiny web framework for Java 8 Spark 2.9.3 is out!! Changeset dependency groupIdcom.sparkjava/groupId artifactIdspark-core/a

Dec 29, 2022

Rapidoid - Extremely Fast, Simple and Powerful Java Web Framework and HTTP Server!

Rapidoid - Simple. Powerful. Secure. Fast! Rapidoid is an extremely fast HTTP server and modern Java web framework / application container, with a str

Dec 30, 2022

A powerful, extendable, flexible yet simple to use commands annotation framework.

Lamp Background Building commands has always been a core concept in many applications, and, lots of times, a really boring and cumbersome one to pull

Jan 5, 2023

a simple mini-project using Spring framework

Room Reservation Service First attempts to learn Spring with Linkedin-Learning led me to create this mini-project; a simple room reservation service f

Sep 23, 2021

A simple and scalable Android bot emulation framework, as presented at Black Hat Europe 2021's Arsenal, as well as atHack 2021's Arsenal

m3 A simple and scalable Android bot emulation framework. A detailed explanation can be found here. This project was first published at Black Hat Euro

Aug 20, 2022
Owner
stubbornwdb
stubbornwdb
Opinionated libraries for HTTP&JSON-based RPC using Retrofit, Feign, OkHttp as clients and Jetty/Jersey as servers

Conjure Java Runtime (formerly http-remoting) This repository provides an opinionated set of libraries for defining and creating RESTish/RPC servers a

Palantir Technologies 76 Dec 13, 2022
LINE 4.1k Jan 2, 2023
Lightweight framework for building java microservices

Ja-micro Ja-micro is a lightweight Java framework for building microservices. Introduction Ja-micro is a framework that allows developers to easily de

Sixt 621 Aug 21, 2022
WSO2 Microservices Framework for Java (MSF4J)

Build status: WSO2 Microservices Framework for Java (MSF4J) WSO2 Microservices Framework for Java (MSF4J) is a lightweight high performance framework

WSO2 359 Dec 27, 2022
Cloud native multi-runtime microservice framework

Femas: Cloud native multi-runtime microservice framework Show me femas username:admin password:123456 If you like,star fork it and join us English | 简

PolarisMesh 352 Apr 23, 2022
A simple rpc framework.

werpc 微RPC 介绍 A simple rpc framework —— werpc. RPC(Remote Procedure Call):远程过程调用,像调用本地方法一样调用远程过程。采用Client-Server结构,通过request-response消息模式实现。 RPC框架就是指封

stubbornwdb 29 Dec 5, 2022
Apache Dubbo is a high-performance, java based, open source RPC framework.

Apache Dubbo Project Apache Dubbo is a high-performance, Java-based open-source RPC framework. Please visit official site for quick start and document

The Apache Software Foundation 38.3k Jan 9, 2023
Apache Dubbo is a high-performance, java based, open source RPC framework.

Apache Dubbo Project Apache Dubbo is a high-performance, Java-based open-source RPC framework. Please visit official site for quick start and document

The Apache Software Foundation 38.2k Dec 31, 2022
High performance RPC framework based on netty

RPC(Remote Procedure Call)实战 @desc: 仅用于个人学习、了解RPC @date: 2021/01/16 技术组成: 版本一 版本二 版本三 传输层 Netty4 * * 编码层 Kryo * * 应用层 JDK动态代理 * * 服务注册与发现 手动注册+guava缓存

XDD 10 Nov 22, 2022