简体   繁体   中英

Apache NiFi - Using multiple FlowFiles as input to a processor

I have a workflow where two or more inputs have set operations performed on them (union, complement, etc.) to produce a single output. I expect to have to write a processor to do the set logic myself, but is it even possible to work with multiple flowfiles of different provenance and work on them simultaneously?

NiFi processors can operate on all of the flowfiles in their input queue(s). For example:

@Override
public void onTrigger(final ProcessContext context, final ProcessSession session) {
    List<FlowFile> flowFiles = session.get(context.getProperty(BATCH_SIZE).asInteger());
    if (flowFiles == null || flowFiles.size() == 0) {
        return;
    }
    // process flowFiles
    ...

You can use the Funnel component to bring multiple inputs together into a single input queue, which can then share the same backpressure and prioritization settings.

NiFi Funnel合并输入队列

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM