Skip to content

Commit

Permalink
Fix configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
DementevNikita committed Jul 20, 2022
1 parent f7aab1a commit 0c843eb
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,13 @@
import org.opendatadiscovery.oddplatform.notification.config.NotificationsProperties;
import org.opendatadiscovery.oddplatform.notification.processor.AlertNotificationMessageProcessor;
import org.opendatadiscovery.oddplatform.notification.wal.PostgresWALMessageDecoder;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.context.event.ApplicationReadyEvent;
import org.springframework.context.event.EventListener;
import org.springframework.stereotype.Component;

@Component
@ConditionalOnProperty(value = "notifications.enabled", havingValue = "true")
@RequiredArgsConstructor
@Slf4j
public class NotificationSubscriberStarter {
Expand All @@ -26,12 +28,8 @@ public class NotificationSubscriberStarter {

@EventListener(ApplicationReadyEvent.class)
public void runLeaderElection() {
if (notificationsProperties.isEnabled()) {
log.debug("Notification subscription is enabled, starting WAL parser");
executorService.submit(new NotificationSubscriber(
notificationsProperties.getWal(), pgConnectionFactory, messageDecoder, messageProcessor));
}

log.debug("Notification subscription is disabled");
log.debug("Notification subscription is enabled, starting WAL parser");
executorService.submit(new NotificationSubscriber(
notificationsProperties.getWal(), pgConnectionFactory, messageDecoder, messageProcessor));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,11 @@
import org.opendatadiscovery.oddplatform.notification.exception.NotificationSenderException;
import org.opendatadiscovery.oddplatform.notification.sender.NotificationSender;
import org.opendatadiscovery.oddplatform.notification.translator.NotificationMessageTranslator;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.stereotype.Component;

@Component
@ConditionalOnProperty(value = "notifications.enabled", havingValue = "true")
@RequiredArgsConstructor
@Slf4j
public class AlertNotificationMessageProcessor implements PostgresWALMessageProcessor {
Expand Down

0 comments on commit 0c843eb

Please sign in to comment.