Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Glossary tree hierarchy state #18703

Merged
merged 21 commits into from
Nov 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
package org.openmetadata.service.governance.workflows;

import static org.openmetadata.schema.entity.events.SubscriptionDestination.SubscriptionType.GOVERNANCE_WORKFLOW_CHANGE_EVENT;

import java.util.HashMap;
import java.util.List;
import java.util.Map;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.tuple.Pair;
import org.openmetadata.schema.entity.events.EventSubscription;
import org.openmetadata.schema.entity.events.SubscriptionDestination;
import org.openmetadata.schema.type.ChangeEvent;
Expand All @@ -13,6 +16,7 @@
import org.openmetadata.service.Entity;
import org.openmetadata.service.apps.bundles.changeEvent.Destination;
import org.openmetadata.service.events.errors.EventPublisherException;
import org.openmetadata.service.exception.CatalogExceptionMessage;
import org.openmetadata.service.resources.feeds.MessageParser;

@Slf4j
Expand Down Expand Up @@ -46,22 +50,33 @@ public WorkflowEventConsumer(
@Override
public void sendMessage(ChangeEvent event) throws EventPublisherException {
// NOTE: We are only consuming ENTITY related events.
EventType eventType = event.getEventType();

if (validEventTypes.contains(eventType)) {
String signal = String.format("%s-%s", event.getEntityType(), eventType.toString());

EntityReference entityReference =
Entity.getEntityReferenceById(event.getEntityType(), event.getEntityId(), Include.ALL);
MessageParser.EntityLink entityLink =
new MessageParser.EntityLink(
event.getEntityType(), entityReference.getFullyQualifiedName());

Map<String, Object> variables = new HashMap<>();

variables.put("relatedEntity", entityLink.getLinkString());

WorkflowHandler.getInstance().triggerWithSignal(signal, variables);
try {
EventType eventType = event.getEventType();

if (validEventTypes.contains(eventType)) {
String signal = String.format("%s-%s", event.getEntityType(), eventType.toString());

EntityReference entityReference =
Entity.getEntityReferenceById(event.getEntityType(), event.getEntityId(), Include.ALL);
MessageParser.EntityLink entityLink =
new MessageParser.EntityLink(
event.getEntityType(), entityReference.getFullyQualifiedName());

Map<String, Object> variables = new HashMap<>();

variables.put("relatedEntity", entityLink.getLinkString());

WorkflowHandler.getInstance().triggerWithSignal(signal, variables);
}
} catch (Exception exc) {
String message =
CatalogExceptionMessage.eventPublisherFailedToPublish(
GOVERNANCE_WORKFLOW_CHANGE_EVENT, event, exc.getMessage());
LOG.error(message);
throw new EventPublisherException(
CatalogExceptionMessage.eventPublisherFailedToPublish(
GOVERNANCE_WORKFLOW_CHANGE_EVENT, exc.getMessage()),
Pair.of(subscriptionDestination.getId(), event));
}
}

Expand Down
Loading
Loading