1- package com .github .cadecode .uniboot .common .plugin .mq .task ;
1+ package com .github .cadecode .uniboot .common .plugin .mq .job ;
22
33import cn .hutool .core .util .ObjUtil ;
44import com .github .cadecode .uniboot .common .plugin .mq .config .TxMsgProperties ;
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