diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/formatter/decorators/MessageDecorator.java b/openmetadata-service/src/main/java/org/openmetadata/service/formatter/decorators/MessageDecorator.java index 8c02df3d95e5..89d9e53a455b 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/formatter/decorators/MessageDecorator.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/formatter/decorators/MessageDecorator.java @@ -387,6 +387,15 @@ default OutgoingMessage createThreadMessage(String publisherName, ChangeEvent ev String.format( "Ends At : %s", getDateString(thread.getAnnouncement().getEndTime()))); } + case ENTITY_DELETED -> { + headerMessage = + String.format( + "[%s] **@%s** posted an update on **Announcement**", + publisherName, thread.getUpdatedBy()); + attachmentList.add( + String.format( + "Announcement Deleted: %s", thread.getAnnouncement().getDescription())); + } } } } diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/util/SubscriptionUtil.java b/openmetadata-service/src/main/java/org/openmetadata/service/util/SubscriptionUtil.java index 359ea9771f5d..f763cce4c4d6 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/util/SubscriptionUtil.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/util/SubscriptionUtil.java @@ -372,22 +372,31 @@ public static Set getTargetsForAlert( handleConversationNotification(category, type, event)); // TODO: For Announcement, Immediate Consumer needs to be Notified (find information from // Lineage) + case Announcement -> { + receiverUrls.addAll(buildReceivers(action, category, type, event, event.getEntityId())); + } } } else { EntityInterface entityInterface = getEntity(event); - receiverUrls.addAll( - buildReceiversListFromActions( - action, - category, - type, - Entity.getCollectionDAO(), - entityInterface.getId(), - event.getEntityType())); + receiverUrls.addAll(buildReceivers(action, category, type, event, entityInterface.getId())); } return receiverUrls; } + private static Set buildReceivers( + SubscriptionAction action, + SubscriptionDestination.SubscriptionCategory category, + SubscriptionDestination.SubscriptionType type, + ChangeEvent event, + UUID id) { + Set result = new HashSet<>(); + result.addAll( + buildReceiversListFromActions( + action, category, type, Entity.getCollectionDAO(), id, event.getEntityType())); + return result; + } + public static List getTargetsForWebhookAlert( SubscriptionAction action, SubscriptionDestination.SubscriptionCategory category,