feat(info-query): 增加更新pulsar backlog数据的接口

This commit is contained in:
v-zhangjc9
2024-04-30 18:28:52 +08:00
parent d88fb7f1e9
commit e894c58d7b
5 changed files with 45 additions and 14 deletions

View File

@@ -17,6 +17,7 @@ import org.slf4j.LoggerFactory;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Service;
import static com.lanyuanxiaoyao.service.common.Constants.HALF_HOUR;
import static com.lanyuanxiaoyao.service.common.Constants.MINUTE;
/**
@@ -46,7 +47,7 @@ public class PulsarMetrics extends Metrics {
backlogMap = Maps.mutable.empty();
}
@Scheduled(fixedDelay = MINUTE, initialDelay = MINUTE)
@Scheduled(fixedDelay = HALF_HOUR, initialDelay = MINUTE)
@Override
void update() {
infoService.tableMetaList()
@@ -71,6 +72,7 @@ public class PulsarMetrics extends Metrics {
if (StrUtil.isNotBlank(name)) {
Long backlog = pulsarService.backlog(name, meta.getTopic(), NameHelper.pulsarSubscriptionName(meta.getJob().getId(), meta.getAlias(), hudiServiceProperties.getSignature()));
backlogCache.set(backlog);
infoService.savePulsarBacklog(meta.getJob().getId(), meta.getAlias(), backlog);
}
} catch (Exception ignored) {
}