# r3 **Repository Path**: sendee/r3 ## Basic Information - **Project Name**: r3 - **Description**: R3 FRAMEWORK - 分布式实时处理框架 - **Primary Language**: Java - **License**: GPL-3.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 5 - **Created**: 2018-01-15 - **Last Updated**: 2020-12-19 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # R3 FRAMEWORK - 分布式实时处理框架 ## 简介 基于Spring的分布式实时处理框架。 ## 逻辑架构设计
## 包结构设计
## 配置样例 ### 接口样例 ``` public interface SayHelloService { @Out(SayHelloOutHandler.class) @In(SayHelloInHandler.class) List sayHello(List names); } ``` ### 分流类 ``` public class SayHelloOutHandler extends OutHandler { @Override public List shard(Object[] parameters, int shardCount) throws Throwable { List result = new ArrayList<>(); List param = (List) parameters[0]; int perSize = param.size() / shardCount; for(int i=0;i list = new ArrayList<>(); for(Object object : results){ list.addAll((List)object); } return list; } } ``` ### 实现类样例 ``` public class SayHelloServiceImpl implements SayHelloService { @Override public List sayHello(List names) { List newNames = new ArrayList<>(); for (String name : names) { String newName = "hello " + name; newNames.add(newName); } return newNames; } } ``` ### Worker端 ``` ``` ### Leader端 ``` ``` ## 配置属性 ### @Out 接口配置 注解类,应用于API接口上,用于参数分流。 Attribute | Description -----------|--------------- value | 用户自定义参数分流类,需要继承自r3.flow.OutHandler ### @In 接口配置 注解类,应用于API接口上,用于参数合流 Attribute | Description -----------|--------------- value | 用户自定义参数合流类,需要继承自r3.flow.InHandler ### r3:application 应用配置 ``` ``` Attribute | Description -----------|--------------- name | 应用名称,必须项,同名的application为同组,组内软负载取其一。 host | 监听地址,默认为“AUTO”,如果为“AUTO”的话,会自动采用本机IP地址。多网卡的情况下可以手动设置IP。 port | 监听端口,默认为20080。 ### r3:registry 注册中心配置 ``` ``` Attribute | Description ------------------|--------------- address | 注册中心zookeeper的地址,默认为“localhost:2181”。 namespace | 应用注册的命名空间,zookeeper的根节点,默认为:r3。 sessionTimeout | 回话超时时间设置,单位为毫秒,默认为3000。 connectionTimeout | 连接的超时时间,单位为毫秒,默认为3000。 interval | 多次尝试注册服务的时间间隔,单位为毫秒,默认为30000。 ### r3:worker 工作者配置 ``` ``` Attribute | Description -----------|--------------- id | spring bean id。 ref | 引用的spring的bean。 interface | 实现的接口类。 ### r3:leader 代理者配置 ``` ``` Attribute | Description -----------|--------------- id | spring bean id。 interface | 代理的接口类。 loadbalance| 负载策略,默认为“random”,尚不支持其他策略。 ## 版本说明 采用行星名称命名。 ## 后续开发计划 1. 引入Filter概念,提供r3-filter模块。 2. 引入leader的超时和重试机制。 3. 提供其他的LoadBalance策略。