Skip to content

Commit

Permalink
SKYEDEN-3234 | Add more logging
Browse files Browse the repository at this point in the history
  • Loading branch information
questras committed Nov 13, 2024
1 parent ebc1541 commit a2d47ca
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
import pl.allegro.tech.hermes.management.infrastructure.zookeeper.ZookeeperClient;
import pl.allegro.tech.hermes.management.infrastructure.zookeeper.ZookeeperClientManager;

@ConditionalOnProperty(value = "detection.inactive-topics.enabled", havingValue = "true")
@ConditionalOnProperty(prefix = "detection.inactive-topics", value = "enabled", havingValue = "true")
@Component
@EnableConfigurationProperties(InactiveTopicsDetectionProperties.class)
public class InactiveTopicsDetectionScheduler {
Expand All @@ -42,6 +42,8 @@ public InactiveTopicsDetectionScheduler(
this.leaderLatch = leaderCuratorFramework.map(it -> new LeaderLatch(it, leaderPath));
if (leaderLatch.isEmpty()) {
logLeaderZookeeperClientNotFound(leaderElectionDc);
} else {
logger.info("Found leader Zookeeper Client, leader latch created");
}
this.job = job;
}
Expand All @@ -50,6 +52,7 @@ public InactiveTopicsDetectionScheduler(
public void startListeningForLeadership() {
leaderLatch.ifPresent(
it -> {
logger.info("Starting listening for leadership");
try {
it.start();
} catch (Exception e) {
Expand All @@ -64,6 +67,8 @@ public void run() {
if (leaderLatch.get().hasLeadership()) {
logger.info("Inactive topics detection started");
job.detectAndNotify();
} else {
logger.info("Inactive topics detection not started - not a leader");
}
} else {
logLeaderZookeeperClientNotFound(leaderElectionDc);
Expand Down

0 comments on commit a2d47ca

Please sign in to comment.