use of com.thinkbiganalytics.metadata.api.event.feed.PreconditionTriggerEvent in project kylo by Teradata.
the class FeedPreconditionService method checkPrecondition.
private void checkPrecondition(Feed feed, OperationStatus operationStatus) {
FeedPrecondition precond = feed.getPrecondition();
if (precond != null) {
log.debug("Checking precondition of feed: {} ({})", feed.getName(), feed.getId());
ServiceLevelAgreement sla = precond.getAgreement();
boolean isAssess = sla.getAllMetrics().stream().anyMatch(metric -> isMetricDependentOnStatus(metric, operationStatus));
if (isAssess) {
ServiceLevelAssessment assessment = this.assessor.assess(sla);
if (assessment.getResult() == AssessmentResult.SUCCESS) {
log.info("Firing precondition trigger event for feed:{} ({})", feed.getName(), feed.getId());
this.eventService.notify(new PreconditionTriggerEvent(feed.getId()));
}
} else {
log.debug("Feed {}.{} does not depend on feed {}", feed.getCategory(), feed.getName(), operationStatus.getFeedName());
}
}
}
Aggregations