use of org.apache.nifi.reporting.util.provenance.ProvenanceEventConsumer in project nifi by apache.
the class ReportLineageToAtlas method initProvenanceConsumer.
private void initProvenanceConsumer(final ConfigurationContext context) throws IOException {
consumer = new ProvenanceEventConsumer();
consumer.setStartPositionValue(context.getProperty(PROVENANCE_START_POSITION).getValue());
consumer.setBatchSize(context.getProperty(PROVENANCE_BATCH_SIZE).asInteger());
consumer.addTargetEventType(lineageStrategy.getTargetEventTypes());
consumer.setLogger(getLogger());
consumer.setScheduled(true);
}
use of org.apache.nifi.reporting.util.provenance.ProvenanceEventConsumer in project nifi by apache.
the class SiteToSiteProvenanceReportingTask method onScheduled.
@OnScheduled
public void onScheduled(final ConfigurationContext context) throws IOException {
consumer = new ProvenanceEventConsumer();
consumer.setStartPositionValue(context.getProperty(START_POSITION).getValue());
consumer.setBatchSize(context.getProperty(BATCH_SIZE).asInteger());
consumer.setLogger(getLogger());
// initialize component type filtering
consumer.setComponentTypeRegex(context.getProperty(FILTER_COMPONENT_TYPE).getValue());
consumer.setComponentTypeRegexExclude(context.getProperty(FILTER_COMPONENT_TYPE_EXCLUDE).getValue());
final String[] targetEventTypes = StringUtils.stripAll(StringUtils.split(context.getProperty(FILTER_EVENT_TYPE).getValue(), ','));
if (targetEventTypes != null) {
for (String type : targetEventTypes) {
try {
consumer.addTargetEventType(ProvenanceEventType.valueOf(type));
} catch (Exception e) {
getLogger().warn(type + " is not a correct event type, removed from the filtering.");
}
}
}
final String[] targetEventTypesExclude = StringUtils.stripAll(StringUtils.split(context.getProperty(FILTER_EVENT_TYPE_EXCLUDE).getValue(), ','));
if (targetEventTypesExclude != null) {
for (String type : targetEventTypesExclude) {
try {
consumer.addTargetEventTypeExclude(ProvenanceEventType.valueOf(type));
} catch (Exception e) {
getLogger().warn(type + " is not a correct event type, removed from the exclude filtering.");
}
}
}
// initialize component ID filtering
final String[] targetComponentIds = StringUtils.stripAll(StringUtils.split(context.getProperty(FILTER_COMPONENT_ID).getValue(), ','));
if (targetComponentIds != null) {
consumer.addTargetComponentId(targetComponentIds);
}
final String[] targetComponentIdsExclude = StringUtils.stripAll(StringUtils.split(context.getProperty(FILTER_COMPONENT_ID_EXCLUDE).getValue(), ','));
if (targetComponentIdsExclude != null) {
consumer.addTargetComponentIdExclude(targetComponentIdsExclude);
}
consumer.setScheduled(true);
}
Aggregations