22 lines
608 B
Java
22 lines
608 B
Java
|
|
package com.czlis.interfaceCommon.websocket;
|
|||
|
|
|
|||
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|||
|
|
import org.springframework.scheduling.annotation.Scheduled;
|
|||
|
|
import org.springframework.stereotype.Component;
|
|||
|
|
|
|||
|
|
@Component
|
|||
|
|
public class RetryMsgTask {
|
|||
|
|
|
|||
|
|
@Autowired
|
|||
|
|
private RetryMsgService retryMsgService;
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* 每5秒执行一次(若依框架支持cron表达式或fixedRate)
|
|||
|
|
*/
|
|||
|
|
@Scheduled(fixedRate = 5000)
|
|||
|
|
public void executeRetry() {
|
|||
|
|
// 多线程处理,避免阻塞定时任务线程
|
|||
|
|
new Thread(retryMsgService::retryProcessMsg).start();
|
|||
|
|
}
|
|||
|
|
}
|