|
29 | 29 | import lombok.Getter; |
30 | 30 | import lombok.Setter; |
31 | 31 | import lombok.extern.slf4j.Slf4j; |
| 32 | +import org.openmetadata.schema.api.events.CreateEventSubscription; |
32 | 33 | import org.openmetadata.schema.entity.events.AlertMetrics; |
33 | 34 | import org.openmetadata.schema.entity.events.EventSubscription; |
34 | 35 | import org.openmetadata.schema.entity.events.EventSubscriptionOffset; |
@@ -106,19 +107,20 @@ private void init(JobExecutionContext context) { |
106 | 107 | return; |
107 | 108 | } |
108 | 109 |
|
109 | | - if (this.eventSubscription.getDestinations() == null |
110 | | - || this.eventSubscription.getDestinations().isEmpty()) { |
111 | | - LOG.error( |
112 | | - "EventSubscription {} has no destinations configured", |
113 | | - this.eventSubscription.getName()); |
114 | | - return; |
115 | | - } |
116 | | - |
117 | 110 | EventSubscriptionOffset eventSubscriptionOffset = loadInitialOffset(context); |
118 | 111 | this.offset = eventSubscriptionOffset.getCurrentOffset(); |
119 | 112 | this.startingOffset = eventSubscriptionOffset.getStartingOffset(); |
120 | 113 | this.alertMetrics = loadInitialMetrics(); |
121 | 114 | this.destinationMap = loadDestinationsMap(context); |
| 115 | + |
| 116 | + // We do not log warning for custom alert type. eg: Reverse Metadata |
| 117 | + if (this.destinationMap.isEmpty() |
| 118 | + && this.eventSubscription.getAlertType() != CreateEventSubscription.AlertType.CUSTOM) { |
| 119 | + LOG.warn( |
| 120 | + "EventSubscription {} has no destinations configured", |
| 121 | + this.eventSubscription.getName()); |
| 122 | + } |
| 123 | + |
122 | 124 | this.doInit(context); |
123 | 125 | } catch (Exception e) { |
124 | 126 | LOG.error("Failed to initialize EventConsumer from JobDataMap", e); |
@@ -204,6 +206,9 @@ private EventSubscriptionOffset loadInitialOffset(JobExecutionContext context) { |
204 | 206 |
|
205 | 207 | private Map<UUID, Destination<ChangeEvent>> loadDestinationsMap(JobExecutionContext context) { |
206 | 208 | Map<UUID, Destination<ChangeEvent>> dMap = new HashMap<>(); |
| 209 | + if (eventSubscription.getDestinations() == null) { |
| 210 | + return dMap; |
| 211 | + } |
207 | 212 | for (SubscriptionDestination subscriptionDest : eventSubscription.getDestinations()) { |
208 | 213 | dMap.put( |
209 | 214 | subscriptionDest.getId(), AlertFactory.getAlert(eventSubscription, subscriptionDest)); |
|
0 commit comments