Skip to content

Commit

Permalink
新增jfinal类型示例项目 "xxl-rpc-sample-jfinal" 支持jfinal项目快速接入分布式RPC服务功能;高兼容性,…
Browse files Browse the repository at this point in the history
…原则上支持任务框架,甚至main方法直接运行;
  • Loading branch information
xuxueli committed Dec 21, 2018
1 parent b36a158 commit 3f18344
Show file tree
Hide file tree
Showing 46 changed files with 73 additions and 71 deletions.
38 changes: 20 additions & 18 deletions doc/XXL-RPC官方文档.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,19 +74,20 @@ RPC(Remote Procedure Call Protocol,远程过程调用),调用远程服
- /doc
- /xxl-rpc-core :核心依赖;
- /xxl-rpc-samples :示例项目;
- /xxl-rpc-executor-sample-frameless :无框架版本示例;
- /xxl-rpc-executor-sample-springboot :springboot版本示例;
- /xxl-rpc-executor-sample-springboot-api :公共API接口
- /xxl-rpc-executor-sample-springboot-client :服务消费方 invoker 调用示例;
- /xxl-rpc-executor-sample-springboot-server :服务提供方 provider 示例;
- /xxl-rpc-sample-frameless :无框架版本示例;
- /xxl-rpc-sample-springboot :springboot版本示例;
- /xxl-rpc-sample-springboot-api :公共API接口
- /xxl-rpc-sample-springboot-client :服务消费方 invoker 调用示例;
- /xxl-rpc-sample-springboot-server :服务提供方 provider 示例;
- / xxl-rpc-sample-jfinal :jfinal版本示例;

### 2.2 配置部署 “分布式服务注册中心XXL-REGISTRY”

推荐使用 "XXL-REGISTRY" 作为注册中心。可前往 XXL-REGISTRY (/~https://github.com/xuxueli/xxl-registry ) 查看部署文档。非常轻量级,一分钟可完成部署工作。


### 2.3 项目中使用XXL-RPC
以示例项目 “xxl-rpc-executor-sample-springboot” 为例讲解;
以示例项目 “xxl-rpc-sample-springboot” 为例讲解;

#### 2.3.1 开发“服务API”
开发RPC服务的 “接口 / interface” 和 “数据模型 / DTO”;
Expand Down Expand Up @@ -237,7 +238,7 @@ callType | 请求类型,可选范围:SYNC(默认)、ONEWAY、FUTURE、CA

得益于优良的兼容性与模块化设计,不限制外部框架;除 spring/springboot 环境之外,理论上支持运行在任何Java代码中,甚至main方法直接启动运行;

以示例项目 “xxl-rpc-executor-sample-frameless” 为例讲解;该示例项目以直连IP方式进行演示,也可以选择接入注册中心方式使用,如接入 XXL-REGISTRY。
以示例项目 “xxl-rpc-sample-frameless” 为例讲解;该示例项目以直连IP方式进行演示,也可以选择接入注册中心方式使用,如接入 XXL-REGISTRY。

### 3.1 API方式创建“服务提供者”:
```
Expand Down Expand Up @@ -408,7 +409,7 @@ XXL-RPC的注册中心,是一个可选组件,不强制依赖;支持服务

### 5.3 版本 v1.2.1 Release Notes[2018-11-09]
- 1、内置注册中心选择ZK时逻辑优化,ZK初始化时unlock逻辑调整,优化断线重连特性;
- 2、除了springboot类型示例;新增无框架示例项目 "xxl-rpc-executor-sample-frameless"。不依赖第三方框架,只需main方法即可启动运行;
- 2、除了springboot类型示例;新增无框架示例项目 "xxl-rpc-sample-frameless"。不依赖第三方框架,只需main方法即可启动运行;
- 3、选型http通讯方式时,校验为IP端口格式地址则主动添加地址前缀;
- 4、RPC异步请求逻辑优化,请求异常时主动通知Client端,避免无效等待时间;
- 5、http通讯方式选型jetty时,线程池升级为QueuedThreadPool,修复jetty9.4版本server自动销毁问题;
Expand Down Expand Up @@ -443,16 +444,17 @@ XXL-RPC的注册中心,是一个可选组件,不强制依赖;支持服务
- 5、服务注册逻辑优化,避免地址重复生成;

### 5.6 版本 v1.3.1 Release Notes[2018-12-21]
- 1、TCP通讯方案Server端Channel线程优化(线程参数=60/300/1000),避免IO线程阻塞于业务;
- 2、TCP通讯方案Client端Channel线程优化(线程参数=10/100/1000),避免IO线程阻塞于callback业务;
- 3、TCP通讯方案Client初始化逻辑优化;
- 4、TCP长连销毁逻辑优化;
- 5、底层Log整理,RPC报错时打印完整Log,包括请求地址,请求参数等;
- 6、负载均衡/软负载:提供丰富的负载均衡策略,包括:轮询、随机、LRU、LFU、一致性HASH等;
- 7、服务发现注册逻辑优化:支持批量注册、摘除,升级 xxl-registry 至 v1.0.1;
- 8、Server端销毁逻辑优化;
- 9、static代码块优化,进行组件无状态优化:response factory等;迁移到invoke factory上来;
- 10、升级多项pom依赖至较新稳定版本;
- 1、负载均衡/软负载:提供丰富的负载均衡策略,包括:轮询、随机、LRU、LFU、一致性HASH等;
- 2、服务发现注册逻辑优化:支持批量注册、摘除,升级 xxl-registry 至 v1.0.1;
- 3、新增jfinal类型示例项目 "xxl-rpc-sample-jfinal" 支持jfinal项目快速接入分布式RPC服务功能;高兼容性,原则上支持任务框架,甚至main方法直接运行;
- 4、TCP通讯方案Server端Channel线程优化(线程参数=60/300/1000),避免IO线程阻塞于业务;
- 5、TCP通讯方案Client端Channel线程优化(线程参数=10/100/1000),避免IO线程阻塞于callback业务;
- 6、TCP通讯方案Client初始化逻辑优化;
- 7、TCP长连销毁逻辑优化;
- 8、底层Log整理,RPC报错时打印完整Log,包括请求地址,请求参数等;
- 9、Server端销毁逻辑优化;
- 10、static代码块优化,进行组件无状态优化:response factory等;迁移到invoke factory上来;
- 11、升级多项pom依赖至较新稳定版本;


### 5.7 版本 v1.3.2 Release Notes[迭代中]
Expand Down
6 changes: 3 additions & 3 deletions xxl-rpc-samples/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
<packaging>pom</packaging>

<modules>
<module>xxl-rpc-executor-sample-frameless</module>
<module>xxl-rpc-executor-sample-springboot</module>
<module>xxl-rpc-executor-sample-jfinal</module>
<module>xxl-rpc-sample-frameless</module>
<module>xxl-rpc-sample-springboot</module>
<module>xxl-rpc-sample-jfinal</module>
</modules>

</project>
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@
<artifactId>xxl-rpc-samples</artifactId>
<version>1.3.1</version>
</parent>
<artifactId>xxl-rpc-executor-sample-frameless</artifactId>
<artifactId>xxl-rpc-sample-frameless</artifactId>
<packaging>pom</packaging>

<modules>
<module>xxl-rpc-executor-sample-frameless-api</module>
<module>xxl-rpc-executor-sample-frameless-client</module>
<module>xxl-rpc-executor-sample-frameless-server</module>
<module>xxl-rpc-sample-frameless-api</module>
<module>xxl-rpc-sample-frameless-client</module>
<module>xxl-rpc-sample-frameless-server</module>
</modules>

</project>
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.xuxueli</groupId>
<artifactId>xxl-rpc-executor-sample-frameless</artifactId>
<artifactId>xxl-rpc-sample-frameless</artifactId>
<version>1.3.1</version>
</parent>
<artifactId>xxl-rpc-executor-sample-frameless-api</artifactId>
<artifactId>xxl-rpc-sample-frameless-api</artifactId>
<packaging>jar</packaging>

</project>
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.xuxueli</groupId>
<artifactId>xxl-rpc-executor-sample-frameless</artifactId>
<artifactId>xxl-rpc-sample-frameless</artifactId>
<version>1.3.1</version>
</parent>
<artifactId>xxl-rpc-executor-sample-frameless-server</artifactId>
<artifactId>xxl-rpc-sample-frameless-client</artifactId>
<packaging>jar</packaging>

<dependencies>
Expand All @@ -28,7 +28,7 @@
<!-- sample-api -->
<dependency>
<groupId>com.xuxueli</groupId>
<artifactId>xxl-rpc-executor-sample-frameless-api</artifactId>
<artifactId>xxl-rpc-sample-frameless-api</artifactId>
<version>${project.parent.version}</version>
</dependency>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender">
<param name="Target" value="System.out" />
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%-d{yyyy-MM-dd HH:mm:ss} xxl-rpc-executor-sample-frameless-server [%c]-[%t]-[%M]-[%L]-[%p] %m%n" />
<param name="ConversionPattern" value="%-d{yyyy-MM-dd HH:mm:ss} xxl-rpc-sample-frameless-client [%c]-[%t]-[%M]-[%L]-[%p] %m%n" />
</layout>
</appender>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.xuxueli</groupId>
<artifactId>xxl-rpc-executor-sample-frameless</artifactId>
<artifactId>xxl-rpc-sample-frameless</artifactId>
<version>1.3.1</version>
</parent>
<artifactId>xxl-rpc-executor-sample-frameless-client</artifactId>
<artifactId>xxl-rpc-sample-frameless-server</artifactId>
<packaging>jar</packaging>

<dependencies>
Expand All @@ -28,7 +28,7 @@
<!-- sample-api -->
<dependency>
<groupId>com.xuxueli</groupId>
<artifactId>xxl-rpc-executor-sample-frameless-api</artifactId>
<artifactId>xxl-rpc-sample-frameless-api</artifactId>
<version>${project.parent.version}</version>
</dependency>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender">
<param name="Target" value="System.out" />
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%-d{yyyy-MM-dd HH:mm:ss} xxl-rpc-executor-sample-frameless-client [%c]-[%t]-[%M]-[%L]-[%p] %m%n" />
<param name="ConversionPattern" value="%-d{yyyy-MM-dd HH:mm:ss} xxl-rpc-sample-frameless-server [%c]-[%t]-[%M]-[%L]-[%p] %m%n" />
</layout>
</appender>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@
<groupId>com.xuxueli</groupId>
<version>1.3.1</version>
</parent>
<artifactId>xxl-rpc-executor-sample-jfinal</artifactId>
<artifactId>xxl-rpc-sample-jfinal</artifactId>
<packaging>pom</packaging>

<modules>
<module>xxl-rpc-executor-sample-jfinal-api</module>
<module>xxl-rpc-executor-sample-jfinal-client</module>
<module>xxl-rpc-executor-sample-jfinal-server</module>
<module>xxl-rpc-sample-jfinal-api</module>
<module>xxl-rpc-sample-jfinal-client</module>
<module>xxl-rpc-sample-jfinal-server</module>
</modules>


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<artifactId>xxl-rpc-executor-sample-jfinal</artifactId>
<artifactId>xxl-rpc-sample-jfinal</artifactId>
<groupId>com.xuxueli</groupId>
<version>1.3.1</version>
</parent>
<artifactId>xxl-rpc-executor-sample-jfinal-api</artifactId>
<artifactId>xxl-rpc-sample-jfinal-api</artifactId>


</project>
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<artifactId>xxl-rpc-executor-sample-jfinal</artifactId>
<artifactId>xxl-rpc-sample-jfinal</artifactId>
<groupId>com.xuxueli</groupId>
<version>1.3.1</version>
</parent>
<artifactId>xxl-rpc-executor-sample-jfinal-client</artifactId>
<artifactId>xxl-rpc-sample-jfinal-client</artifactId>
<packaging>war</packaging>

<dependencies>
Expand Down Expand Up @@ -37,7 +37,7 @@
<!-- sample-api -->
<dependency>
<groupId>com.xuxueli</groupId>
<artifactId>xxl-rpc-executor-sample-jfinal-api</artifactId>
<artifactId>xxl-rpc-sample-jfinal-api</artifactId>
<version>${project.parent.version}</version>
</dependency>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,16 @@
<appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender">
<param name="Target" value="System.out" />
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%-d{yyyy-MM-dd HH:mm:ss} xxl-rpc-executor-sample-jfinal-server [%c]-[%t]-[%M]-[%L]-[%p] %m%n"/>
<param name="ConversionPattern" value="%-d{yyyy-MM-dd HH:mm:ss} xxl-rpc-sample-jfinal-client [%c]-[%t]-[%M]-[%L]-[%p] %m%n"/>
</layout>
</appender>

<appender name="FILE" class="org.apache.log4j.DailyRollingFileAppender">
<param name="file" value="/data/applogs/xxl-rpc/xxl-rpc-executor-sample-jfinal-server.log"/>
<param name="file" value="/data/applogs/xxl-rpc/xxl-rpc-sample-jfinal-client.log"/>
<param name="append" value="true"/>
<param name="encoding" value="UTF-8"/>
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%-d{yyyy-MM-dd HH:mm:ss} xxl-rpc-executor-sample-jfinal-server [%c]-[%t]-[%M]-[%L]-[%p] %m%n"/>
<param name="ConversionPattern" value="%-d{yyyy-MM-dd HH:mm:ss} xxl-rpc-sample-jfinal-client [%c]-[%t]-[%M]-[%L]-[%p] %m%n"/>
</layout>
</appender>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
id="WebApp_ID" version="2.5">

<display-name>xxl-rpc-executor-sample-jfinal-client</display-name>
<display-name>xxl-rpc-sample-jfinal-client</display-name>
<context-param>
<param-name>webAppRootKey</param-name>
<param-value>xxl-rpc-executor-sample-jfinal-client</param-value>
<param-value>xxl-rpc-sample-jfinal-client</param-value>
</context-param>

<!-- jfinal -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<artifactId>xxl-rpc-executor-sample-jfinal</artifactId>
<artifactId>xxl-rpc-sample-jfinal</artifactId>
<groupId>com.xuxueli</groupId>
<version>1.3.1</version>
</parent>
<artifactId>xxl-rpc-executor-sample-jfinal-server</artifactId>
<artifactId>xxl-rpc-sample-jfinal-server</artifactId>
<packaging>war</packaging>

<dependencies>
Expand Down Expand Up @@ -37,7 +37,7 @@
<!-- sample-api -->
<dependency>
<groupId>com.xuxueli</groupId>
<artifactId>xxl-rpc-executor-sample-jfinal-api</artifactId>
<artifactId>xxl-rpc-sample-jfinal-api</artifactId>
<version>${project.parent.version}</version>
</dependency>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,16 @@
<appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender">
<param name="Target" value="System.out" />
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%-d{yyyy-MM-dd HH:mm:ss} xxl-rpc-executor-sample-jfinal-client [%c]-[%t]-[%M]-[%L]-[%p] %m%n"/>
<param name="ConversionPattern" value="%-d{yyyy-MM-dd HH:mm:ss} xxl-rpc-sample-jfinal-server [%c]-[%t]-[%M]-[%L]-[%p] %m%n"/>
</layout>
</appender>

<appender name="FILE" class="org.apache.log4j.DailyRollingFileAppender">
<param name="file" value="/data/applogs/xxl-rpc/xxl-rpc-executor-sample-jfinal-client.log"/>
<param name="file" value="/data/applogs/xxl-rpc/xxl-rpc-sample-jfinal-server.log"/>
<param name="append" value="true"/>
<param name="encoding" value="UTF-8"/>
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%-d{yyyy-MM-dd HH:mm:ss} xxl-rpc-executor-sample-jfinal-client [%c]-[%t]-[%M]-[%L]-[%p] %m%n"/>
<param name="ConversionPattern" value="%-d{yyyy-MM-dd HH:mm:ss} xxl-rpc-sample-jfinal-server [%c]-[%t]-[%M]-[%L]-[%p] %m%n"/>
</layout>
</appender>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
id="WebApp_ID" version="2.5">

<display-name>xxl-rpc-executor-sample-jfinal-client</display-name>
<display-name>xxl-rpc-sample-jfinal-client</display-name>
<context-param>
<param-name>webAppRootKey</param-name>
<param-value>xxl-rpc-executor-sample-jfinal-client</param-value>
<param-value>xxl-rpc-sample-jfinal-client</param-value>
</context-param>

<!-- jfinal -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@
<artifactId>xxl-rpc-samples</artifactId>
<version>1.3.1</version>
</parent>
<artifactId>xxl-rpc-executor-sample-springboot</artifactId>
<artifactId>xxl-rpc-sample-springboot</artifactId>
<packaging>pom</packaging>

<modules>
<module>xxl-rpc-executor-sample-springboot-api</module>
<module>xxl-rpc-executor-sample-springboot-client</module>
<module>xxl-rpc-executor-sample-springboot-server</module>
<module>xxl-rpc-sample-springboot-api</module>
<module>xxl-rpc-sample-springboot-client</module>
<module>xxl-rpc-sample-springboot-server</module>
</modules>

</project>
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.xuxueli</groupId>
<artifactId>xxl-rpc-executor-sample-springboot</artifactId>
<artifactId>xxl-rpc-sample-springboot</artifactId>
<version>1.3.1</version>
</parent>
<artifactId>xxl-rpc-executor-sample-springboot-api</artifactId>
<artifactId>xxl-rpc-sample-springboot-api</artifactId>
<packaging>jar</packaging>

</project>
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.xuxueli</groupId>
<artifactId>xxl-rpc-executor-sample-springboot</artifactId>
<artifactId>xxl-rpc-sample-springboot</artifactId>
<version>1.3.1</version>
</parent>
<artifactId>xxl-rpc-executor-sample-springboot-client</artifactId>
<artifactId>xxl-rpc-sample-springboot-client</artifactId>
<packaging>jar</packaging>


Expand Down Expand Up @@ -46,7 +46,7 @@
<!-- sample-api -->
<dependency>
<groupId>com.xuxueli</groupId>
<artifactId>xxl-rpc-executor-sample-springboot-api</artifactId>
<artifactId>xxl-rpc-sample-springboot-api</artifactId>
<version>${project.parent.version}</version>
</dependency>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<configuration debug="false" scan="true" scanPeriod="1 seconds">

<contextName>logback</contextName>
<property name="log.path" value="/data/applogs/xxl-rpc/xxl-rpc-executor-sample-springboot-client.log"/>
<property name="log.path" value="/data/applogs/xxl-rpc/xxl-rpc-sample-springboot-client.log"/>

<appender name="console" class="ch.qos.logback.core.ConsoleAppender">
<!-- <filter class="ch.qos.logback.classic.filter.ThresholdFilter" >
Expand Down
Loading

0 comments on commit 3f18344

Please sign in to comment.