# gorilla-gt **Repository Path**: coder_hw/gorilla-gt ## Basic Information - **Project Name**: gorilla-gt - **Description**: 轻量级、方便使用的RPC框架 - **Primary Language**: Java - **License**: Apache-2.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2025-04-21 - **Last Updated**: 2025-04-21 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # gorilla 轻量级、方便使用的RPC框架 ## 说明 gorilla中分为服务提供方(RPC Server),服务调用方(RPC Client)和服务注册中心(Registry)三个角色。 Server提供服务,向Registry注册自身服务,并向注册中心定期发送心跳汇报状态。 Client使用服务,需要向注册中心订阅RPC服务,Client根据Registry返回的服务列表,与具体的Sever建立连接,并进行RPC调用。 当Server发生变更时,Registry会同步变更,Client感知后会对本地的服务列表作相应调整。 三者的交互关系如下图: ![avatar](/img/14612349319195.jpg) ## 示例 ```java //接口 public interface Inter1 { public String helloRpc(String arg); } ``` ```java //实现 public class Impl1 implements Inter1{ @Override public String helloRpc(String arg) { return arg; } } ``` ```xml ``` ```xml ``` ```java //测试代码 public static void main(String[] args) { ApplicationContext context = new ClassPathXmlApplicationContext(new String[] {"classpath*:client.xml" }); System.out.println(context.getBean(Inter1.class).test("111")); } ```