Support Questions
Find answers, ask questions, and share your expertise

Transfer relationship not specified

New Contributor

I am getting "Transfer relationship not specified" and I am not sure why. I am quite new in NiFi and I think it is a stupid mistake.



@Override
public void onTrigger ( final ProcessContext context, final ProcessSession session ) throws ProcessException {
    FlowFile inFlowFile = session.get ();
    if ( inFlowFile == null ) {
        return;
    }
    List strList = new ArrayList<> ();
    session.read ( inFlowFile, new InputStreamCallback () {
        @Override
        public void process ( InputStream in ) throws IOException {
            try {
                InputStreamReader inR = new InputStreamReader ( in );
                BufferedReader buf = new BufferedReader ( inR );
                // my business logic just generate list of strings in strList
        }
    } );

    strList.stream ().forEach ( substance -> {
        FlowFile out = session.create ( inFlowFile );
        out = session.write ( out, new OutputStreamCallback () {
            @Override
            public void process ( OutputStream out ) throws IOException {
                out.write ( substance.getBytes () );
            }
        } );
        session.transfer ( out, SUCCESS ); 
    } );
    session.commit ();
}



0 REPLIES 0