All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.openmetadata.service.apps.bundles.changeEvent.AlertPublisher Maven / Gradle / Ivy

There is a newer version: 1.5.11
Show newest version
package org.openmetadata.service.apps.bundles.changeEvent;

import java.util.UUID;
import lombok.extern.slf4j.Slf4j;
import org.openmetadata.schema.type.ChangeEvent;
import org.openmetadata.service.events.errors.EventPublisherException;

@Slf4j
public class AlertPublisher extends AbstractEventConsumer {

  @Override
  public void sendAlert(UUID receiverId, ChangeEvent event) throws EventPublisherException {
    if (destinationMap.containsKey(receiverId)) {
      Destination destination = destinationMap.get(receiverId);
      if (Boolean.TRUE.equals(destination.getEnabled())) {
        destination.sendMessage(event);
      } else {
        LOG.debug(
            "Event Subscription:{} Skipping sending message since, disabled subscription with Id: {}",
            eventSubscription.getName(),
            receiverId);
      }
    } else {
      LOG.debug(
          "Event Subscription:{} Cannot find Destination Subscription With Id: {}",
          eventSubscription.getName(),
          receiverId);
    }
  }

  @Override
  public boolean getEnabled() {
    return getEventSubscription().getEnabled();
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy