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

Errors Nifi custom processor modify content and send to multiple relationships

Errors Nifi custom processor modify content and send to multiple relationships

Explorer

I am trying to simply take the content from a file I break up with SplitProcessor and send the line of text to a text FlowFile and convert that line to JSON and send to another flowFile in onTrigger(). I have tried cloning/creating new session but I am missing something.

// Snippets

onTrigger() {
...
// read flowFile text line and send over to "TEXT" relationship (works fine)
String content = new String(buffer,...);
ff = session.write(ff, new OutputStream...);
session.transfer(ff, TEXT);
session.remove(ff);

// now convert that string to JSON and send to JSON
ff2 = session.create();
String jsonString = toJson(content);
// write to ff2
ff2 = session.write(ff2, ...
session.transfer(ff2, JSON);
session.remove(ff2);

I do get errors depending on if I remove or not (NullPointer, already marked for transfer...)

Is there an example here that show how to do what I want to do?

Thanks

MK