Skip to content

Commit

Permalink
refactor: 优化PersistenceBuffer逻辑
Browse files Browse the repository at this point in the history
  • Loading branch information
zhou-hao committed Jun 11, 2024
1 parent af11c55 commit 7e24f3d
Show file tree
Hide file tree
Showing 6 changed files with 542 additions and 168 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,8 @@ public class BufferProperties {

//最大重试次数,超过此次数的数据将会放入死队列.
private long maxRetryTimes = 64;

public boolean isExceededRetryCount(int count) {
return maxRetryTimes > 0 && count >= maxRetryTimes;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
package org.jetlinks.community.buffer;

/**
* 已缓冲的数据
*
* @param <T> 数据类型
* @author zhouhao
* @since 2.2
*/
public interface Buffered<T> {

/**
* @return 数据
*/
T getData();

/**
* @return 当前重试次数
*/
int getRetryTimes();

/**
* 标记是否重试此数据
*/
void retry(boolean retry);

/**
* 标记此数据为死信
*/
void dead();
}
Loading

0 comments on commit 7e24f3d

Please sign in to comment.