Search code examples
minifyapache-nifi

Does nifi supports Transfering single Flow file to multiple Relationships in a Processor?


I am exploring options for Transferring single Flowfile to two or more Relationships in my custom processor,i didn't found any help in documentation for this, Does this feature supported by NIFI?

Example Code:

session.transfer(flowFile, REL_SUCCESS_1);
session.transfer(flowFile, REL_SUCCESS_2);

Solution

  • you can use session.clone() method:

    FlowFile flowFile2 = session.clone(flowFile);
    session.transfer(flowFile, REL_SUCCESS_1);
    session.transfer(flowFile2, REL_SUCCESS_2);
    

    to create a full clone of the flow file.

    the content and attributes will be the same...