Support Questions

Find answers, ask questions, and share your expertise

Query on NiFi relationships

avatar
Expert Contributor

I need some inputs on relationship definitions in a custom processor code:

1. Do I need to define all three(success, failure, original) relationships in processor class?

2. Do I need to handle all three relationships(using session.transfer(....))?

3. Why do I need to transfer original flowfile as it has been processed?

1 ACCEPTED SOLUTION

avatar
Super Collaborator
  1. InvokeScriptedProcessor is the closest you'll get to a native (NAR) NiFi processor from my experience. With it, you do NOT need to define all three relationships...if your code handles all possible problems correctly, you could just have "success" or other for your relationship.
  2. From what I've seen you do need to have at least one relationship if you're modifying the FlowFile or creating new ones and require session.transfer to send it to that relationship.
  3. You don't need to transfer the original...if you read the original FlowFile and create a new one or several new ones you can dispose of the original with session.remove(your_orginal_flow_file) 

View solution in original post

1 REPLY 1

avatar
Super Collaborator
  1. InvokeScriptedProcessor is the closest you'll get to a native (NAR) NiFi processor from my experience. With it, you do NOT need to define all three relationships...if your code handles all possible problems correctly, you could just have "success" or other for your relationship.
  2. From what I've seen you do need to have at least one relationship if you're modifying the FlowFile or creating new ones and require session.transfer to send it to that relationship.
  3. You don't need to transfer the original...if you read the original FlowFile and create a new one or several new ones you can dispose of the original with session.remove(your_orginal_flow_file)