mirror of
https://github.com/open-metadata/OpenMetadata.git
synced 2025-11-02 11:39:12 +00:00
ElasticSearch & Slack Event publishers
This commit is contained in:
parent
0ae7982ec2
commit
b368d093af
@ -187,13 +187,18 @@ public class CatalogApplication extends Application<CatalogApplicationConfig> {
|
||||
throws NoSuchMethodException, ClassNotFoundException, IllegalAccessException, InvocationTargetException,
|
||||
InstantiationException {
|
||||
// register ElasticSearch Event publisher
|
||||
ElasticSearchEventPublisher elasticSearchEventPublisher =
|
||||
new ElasticSearchEventPublisher(catalogApplicationConfig.getElasticSearchConfiguration());
|
||||
EventPubSub.addEventHandler(elasticSearchEventPublisher);
|
||||
if (catalogApplicationConfig.getElasticSearchConfiguration() != null) {
|
||||
ElasticSearchEventPublisher elasticSearchEventPublisher =
|
||||
new ElasticSearchEventPublisher(catalogApplicationConfig.getElasticSearchConfiguration());
|
||||
EventPubSub.addEventHandler(elasticSearchEventPublisher);
|
||||
}
|
||||
// register slack Event publishers
|
||||
for (SlackPublisherConfiguration slackPublisherConfiguration : catalogApplicationConfig.getSlackEventPublishers()) {
|
||||
SlackWebhookEventPublisher slackPublisher = new SlackWebhookEventPublisher(slackPublisherConfiguration);
|
||||
EventPubSub.addEventHandler(slackPublisher);
|
||||
if (catalogApplicationConfig.getSlackEventPublishers() != null) {
|
||||
for (SlackPublisherConfiguration slackPublisherConfiguration :
|
||||
catalogApplicationConfig.getSlackEventPublishers()) {
|
||||
SlackWebhookEventPublisher slackPublisher = new SlackWebhookEventPublisher(slackPublisherConfiguration);
|
||||
EventPubSub.addEventHandler(slackPublisher);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -102,7 +102,8 @@ public class ElasticSearchEventPublisher extends AbstractEventPublisher {
|
||||
client.update(updateRequest, RequestOptions.DEFAULT);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
LOG.error("failed to update ES doc", e);
|
||||
LOG.error("failed to update ES doc");
|
||||
LOG.debug(e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -48,6 +48,9 @@ public class ChangeEventHandler implements EventHandler {
|
||||
changeEvent.getEventType(),
|
||||
changeEvent.getEntityType());
|
||||
EventPubSub.publish(changeEvent);
|
||||
if (changeEvent.getEntity() != null) {
|
||||
changeEvent.setEntity(JsonUtils.pojoToJson(changeEvent.getEntity()));
|
||||
}
|
||||
dao.changeEventDAO().insert(JsonUtils.pojoToJson(changeEvent));
|
||||
}
|
||||
} catch (Exception e) {
|
||||
|
||||
@ -1117,7 +1117,6 @@ public abstract class EntityResourceTest<T> extends CatalogApplicationTest {
|
||||
compareEntities(
|
||||
entityInterface.getEntity(), JsonUtils.readValue((String) changeEvent.getEntity(), entityClass), authHeaders);
|
||||
} else if (expectedEventType == EventType.ENTITY_UPDATED) {
|
||||
assertNull(changeEvent.getEntity());
|
||||
assertChangeDescription(expectedChangeDescription, changeEvent.getChangeDescription());
|
||||
} else if (expectedEventType == EventType.ENTITY_DELETED) {
|
||||
assertListNull(changeEvent.getEntity(), changeEvent.getChangeDescription());
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user