
pl.allegro.tech.hermes.management.infrastructure.detection.InactiveTopicsDetectionScheduler Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of hermes-management Show documentation
Show all versions of hermes-management Show documentation
Fast and reliable message broker built on top of Kafka.
package pl.allegro.tech.hermes.management.infrastructure.detection;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.scheduling.annotation.Scheduled;
import pl.allegro.tech.hermes.management.domain.detection.InactiveTopicsDetectionJob;
import pl.allegro.tech.hermes.management.infrastructure.leader.ManagementLeadership;
public class InactiveTopicsDetectionScheduler {
private final InactiveTopicsDetectionJob job;
private final ManagementLeadership leader;
private static final Logger logger =
LoggerFactory.getLogger(InactiveTopicsDetectionScheduler.class);
public InactiveTopicsDetectionScheduler(
InactiveTopicsDetectionJob job, ManagementLeadership leader) {
this.leader = leader;
this.job = job;
}
@Scheduled(cron = "${detection.inactive-topics.cron}")
public void run() {
if (leader.isLeader()) {
logger.info("Inactive topics detection started");
job.detectAndNotify();
} else {
logger.info("Inactive topics detection not started - not a leader");
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy