Search in sources :

Example 1 with ProvenanceEventConsumer

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);
}
Also used : ProvenanceEventConsumer(org.apache.nifi.reporting.util.provenance.ProvenanceEventConsumer)

Example 2 with ProvenanceEventConsumer

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);
}
Also used : ProvenanceEventConsumer(org.apache.nifi.reporting.util.provenance.ProvenanceEventConsumer) ProcessException(org.apache.nifi.processor.exception.ProcessException) MalformedURLException(java.net.MalformedURLException) IOException(java.io.IOException) OnScheduled(org.apache.nifi.annotation.lifecycle.OnScheduled)

Aggregations

ProvenanceEventConsumer (org.apache.nifi.reporting.util.provenance.ProvenanceEventConsumer)2 IOException (java.io.IOException)1 MalformedURLException (java.net.MalformedURLException)1 OnScheduled (org.apache.nifi.annotation.lifecycle.OnScheduled)1 ProcessException (org.apache.nifi.processor.exception.ProcessException)1