mirror of
https://github.com/open-metadata/OpenMetadata.git
synced 2025-11-07 05:53:46 +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,
|
throws NoSuchMethodException, ClassNotFoundException, IllegalAccessException, InvocationTargetException,
|
||||||
InstantiationException {
|
InstantiationException {
|
||||||
// register ElasticSearch Event publisher
|
// register ElasticSearch Event publisher
|
||||||
ElasticSearchEventPublisher elasticSearchEventPublisher =
|
if (catalogApplicationConfig.getElasticSearchConfiguration() != null) {
|
||||||
new ElasticSearchEventPublisher(catalogApplicationConfig.getElasticSearchConfiguration());
|
ElasticSearchEventPublisher elasticSearchEventPublisher =
|
||||||
EventPubSub.addEventHandler(elasticSearchEventPublisher);
|
new ElasticSearchEventPublisher(catalogApplicationConfig.getElasticSearchConfiguration());
|
||||||
|
EventPubSub.addEventHandler(elasticSearchEventPublisher);
|
||||||
|
}
|
||||||
// register slack Event publishers
|
// register slack Event publishers
|
||||||
for (SlackPublisherConfiguration slackPublisherConfiguration : catalogApplicationConfig.getSlackEventPublishers()) {
|
if (catalogApplicationConfig.getSlackEventPublishers() != null) {
|
||||||
SlackWebhookEventPublisher slackPublisher = new SlackWebhookEventPublisher(slackPublisherConfiguration);
|
for (SlackPublisherConfiguration slackPublisherConfiguration :
|
||||||
EventPubSub.addEventHandler(slackPublisher);
|
catalogApplicationConfig.getSlackEventPublishers()) {
|
||||||
|
SlackWebhookEventPublisher slackPublisher = new SlackWebhookEventPublisher(slackPublisherConfiguration);
|
||||||
|
EventPubSub.addEventHandler(slackPublisher);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -102,7 +102,8 @@ public class ElasticSearchEventPublisher extends AbstractEventPublisher {
|
|||||||
client.update(updateRequest, RequestOptions.DEFAULT);
|
client.update(updateRequest, RequestOptions.DEFAULT);
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} 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.getEventType(),
|
||||||
changeEvent.getEntityType());
|
changeEvent.getEntityType());
|
||||||
EventPubSub.publish(changeEvent);
|
EventPubSub.publish(changeEvent);
|
||||||
|
if (changeEvent.getEntity() != null) {
|
||||||
|
changeEvent.setEntity(JsonUtils.pojoToJson(changeEvent.getEntity()));
|
||||||
|
}
|
||||||
dao.changeEventDAO().insert(JsonUtils.pojoToJson(changeEvent));
|
dao.changeEventDAO().insert(JsonUtils.pojoToJson(changeEvent));
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
|||||||
@ -1117,7 +1117,6 @@ public abstract class EntityResourceTest<T> extends CatalogApplicationTest {
|
|||||||
compareEntities(
|
compareEntities(
|
||||||
entityInterface.getEntity(), JsonUtils.readValue((String) changeEvent.getEntity(), entityClass), authHeaders);
|
entityInterface.getEntity(), JsonUtils.readValue((String) changeEvent.getEntity(), entityClass), authHeaders);
|
||||||
} else if (expectedEventType == EventType.ENTITY_UPDATED) {
|
} else if (expectedEventType == EventType.ENTITY_UPDATED) {
|
||||||
assertNull(changeEvent.getEntity());
|
|
||||||
assertChangeDescription(expectedChangeDescription, changeEvent.getChangeDescription());
|
assertChangeDescription(expectedChangeDescription, changeEvent.getChangeDescription());
|
||||||
} else if (expectedEventType == EventType.ENTITY_DELETED) {
|
} else if (expectedEventType == EventType.ENTITY_DELETED) {
|
||||||
assertListNull(changeEvent.getEntity(), changeEvent.getChangeDescription());
|
assertListNull(changeEvent.getEntity(), changeEvent.getChangeDescription());
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user