Skip to content

Commit 94b4efc

Browse files
committed
refactor: txMsg 默认关闭重试和清理
1 parent b511487 commit 94b4efc

2 files changed

Lines changed: 11 additions & 10 deletions

File tree

common/plugin/mq/src/main/java/com/github/cadecode/uniboot/common/plugin/mq/config/TxMsgProperties.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public class TxMsgProperties implements InitializingBean {
4343
/**
4444
* 是否开启重试
4545
*/
46-
private Boolean enableRetry = true;
46+
private Boolean enableRetry = false;
4747

4848
/**
4949
* 定时重试间隔时间
@@ -58,7 +58,7 @@ public class TxMsgProperties implements InitializingBean {
5858
/**
5959
* 是否开启自动清理
6060
*/
61-
private Boolean autoClear = true;
61+
private Boolean autoClear = false;
6262

6363
/**
6464
* 自动清理多久之前的记录

common/plugin/mq/src/main/java/com/github/cadecode/uniboot/common/plugin/mq/task/TxMsgTask.java renamed to common/plugin/mq/src/main/java/com/github/cadecode/uniboot/common/plugin/mq/job/TxMsgJobRegister.java

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package com.github.cadecode.uniboot.common.plugin.mq.task;
1+
package com.github.cadecode.uniboot.common.plugin.mq.job;
22

33
import cn.hutool.core.util.ObjUtil;
44
import com.github.cadecode.uniboot.common.plugin.mq.config.TxMsgProperties;
@@ -19,7 +19,7 @@
1919
@Slf4j
2020
@RequiredArgsConstructor
2121
@Component
22-
public class TxMsgTask {
22+
public class TxMsgJobRegister {
2323

2424
private final ThreadPoolTaskScheduler taskScheduler;
2525

@@ -29,13 +29,14 @@ public class TxMsgTask {
2929

3030
@EventListener(ApplicationStartedEvent.class)
3131
public void onApplicationStartedEvent() {
32-
if (ObjUtil.equals(txMsgProperties.getEnableRetry(), false)) {
33-
log.info("TxMsg task enable retry false");
34-
return;
32+
// 消息定时 retry
33+
log.info("TxMsg task do retry start, {}", txMsgProperties.getEnableRetry());
34+
if (ObjUtil.equals(txMsgProperties.getEnableRetry(), true)) {
35+
taskScheduler.scheduleWithFixedDelay(txMsgTaskHandler::doRetry, txMsgProperties.getRetryFixDelay());
3536
}
36-
log.info("TxMsg task do retry started");
37-
taskScheduler.scheduleWithFixedDelay(txMsgTaskHandler::doRetry, txMsgProperties.getRetryFixDelay());
38-
log.info("TxMsg task do clear started, {}", txMsgProperties.getAutoClear());
37+
38+
// 消息定时清理
39+
log.info("TxMsg task do clear start, {}", txMsgProperties.getAutoClear());
3940
if (ObjUtil.equal(txMsgProperties.getAutoClear(), true)) {
4041
taskScheduler.scheduleWithFixedDelay(() -> txMsgTaskHandler.doClear(txMsgProperties.getAutoClearInterval()),
4142
txMsgProperties.getClearFixDelay());

0 commit comments

Comments
 (0)