https://github.com/houbb/sisyphus
The java retry framework.(支持注解的 java 重试框架)
https://github.com/houbb/sisyphus
gauva guava-retrying java-retry retry spring-retry
Last synced: 7 months ago
JSON representation
The java retry framework.(支持注解的 java 重试框架)
- Host: GitHub
- URL: https://github.com/houbb/sisyphus
- Owner: houbb
- License: apache-2.0
- Created: 2019-05-18T00:43:35.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2024-02-02T22:07:18.000Z (over 1 year ago)
- Last Synced: 2025-03-30T10:08:38.238Z (7 months ago)
- Topics: gauva, guava-retrying, java-retry, retry, spring-retry
- Language: Java
- Homepage: https://sisyphus-doc.github.io/
- Size: 250 KB
- Stars: 184
- Watchers: 6
- Forks: 68
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# Sisyphus
[Sisyphus](https://github.com/houbb/sisyphus) 是支持过程式编程和注解编程的 java 重试框架。
[](https://www.travis-ci.org/houbb/sisyphus?branch=master)
[](http://mvnrepository.com/artifact/com.github.houbb/sisyphus)
[](https://github.com/houbb/sisyphus/blob/master/LICENSE.txt)
[](https://github.com/houbb/sisyphus)

## 特性
- 支持 fluent 过程式编程
- 基于字节码的代理重试
- 基于注解的重试,允许自定义注解
- 无缝接入 spring
- 无缝接入 spring-boot
- 接口与注解的统一
- 解决 spring-retry 与 guava-retrying 中的不足之处
### v0.1.0 变更
- Recover 上下文增加入参,更加便于业务处理
### 更新记录
> [更新记录](doc/CHANGE_LOG.md)
## 设计目的
综合了 spring-retry 和 gauva-retrying 的优势。
调整一些特性,使其更利于实际使用。
采用 Netty 类似的接口思想,保证接口的一致性,和替换的灵活性。
借鉴 Hibernate-Validator 的设计,允许用户自定义注解。
> [spring-retry 与 guava-retrying 中的不足之处](https://juejin.cn/post/7020767222687612964)
## 开源地址
> [sisyphus](https://github.com/houbb/sisyphus)
# 快速开始
## 引入
```xml
com.github.houbb
sisyphus-core
0.1.0
```
## 入门代码
详情参见 [RetryerTest](https://github.com/houbb/sisyphus/blob/master/sisyphus-test/src/test/java/com/github/houbb/sispyhus/test/core/RetryerTest.java)
```java
public void helloTest() {
Retryer.newInstance()
.callable(new Callable() {
@Override
public String call() throws Exception {
System.out.println("called...");
throw new RuntimeException();
}
}).retryCall();
}
```
## 代码分析
- callable
指定一个 callable 的实现。
我们打印一条日志,并且模拟一个程序异常。
## 日志信息
日志信息
```
called...
called...
called...
```
和一些其他异常信息。
重试触发的条件,默认是程序发生了异常
这里的重试间隔默认为没有时间间隔,一共尝试3次。(包括第一次程序本身执行)
# 拓展阅读
[00-sisyphus 是什么](doc/user/00-what-is-sisyphus.md)
[01-为什么选择 sisyphus](doc/user/01-why-sisyphus.md)
[02-sisyphus 模块简介](doc/user/02-sisyphus-modules.md)
[03-sisyphus 快速开始](doc/user/03-quick-start.md)
[04-sisyphus 配置概览](doc/user/04-config-overview.md)
[05-sisyphus 注解简介](doc/user/05-annotation.md)
[06-sisyphus 代理模板](doc/user/06-proxy-template.md)
[07-sisyphus spring 整合](doc/user/07-spring-integration.md)
[08-sisyphus springboot 整合](doc/user/08-springboot-integration.md)
# 后期 Road-MAP
- [ ] 丰富上下文信息
- [ ] 丰富重试统计信息
# 中间件等工具开源矩阵
[heaven: 收集开发中常用的工具类](https://github.com/houbb/heaven)
[rpc: 基于 netty4 实现的远程调用工具](https://github.com/houbb/rpc)
[mq: 简易版 mq 实现](https://github.com/houbb/mq)
[ioc: 模拟简易版 spring ioc](https://github.com/houbb/ioc)
[mybatis: 简易版 mybatis](https://github.com/houbb/mybatis)
[cache: 渐进式 redis 缓存](https://github.com/houbb/cache)
[jdbc-pool: 数据库连接池实现](https://github.com/houbb/jdbc-pool)
[sandglass: 任务调度时间工具框架](https://github.com/houbb/sandglass)
[sisyphus: 支持注解的重试框架](https://github.com/houbb/sisyphus)
[resubmit: 防止重复提交框架,支持注解](https://github.com/houbb/resubmit)
[auto-log: 日志自动输出](https://github.com/houbb/auto-log)
[async: 多线程异步并行框架](https://github.com/houbb/async)