Uploaded image for project: 'Apache NiFi'
  1. Apache NiFi
  2. NIFI-3860

Consider relaxing the constraint that ProcessSession enforces we give it the most recent version of a FlowFile

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • None
    • 1.3.0
    • Core Framework
    • None

    Description

      Currently, when we call methods on ProcessSession to access or modify a FlowFile, the ProcessSession will roll itself back and throw a FlowFileHandlingException with the message "<FlowFile> is not the most recent version of this FlowFile within this session". This was done to ensure that Processor developers ensure that they know what they are doing and always have the most recent version of a FlowFile. However, this comes with a few downsides:

      • It can result in code being complex in error-handling cases when we need to ensure that no matter what we hold the most recent version of a FlowFile
      • It's easy to call session.putAttribute and forget to store the most recent version of the FlowFile, which gets returned - this is most problematic when dealing with a Collection<FlowFile>.
      • We have a method for ProcessSession.read(FlowFile) that returns an InputStream. However, we don't have a corresponding write() method. This is due to the fact that once we finish writing to the FlowFile, we would have to return the most up-to-date version of the FlowFile and there's no way to do that if returning an OutputStream.

      We should consider relaxing this constraint and instead just always make use of the most recent version of the FlowFile, even if an older version of the FlowFile is passed in.

      Attachments

        Issue Links

          Activity

            People

              markap14 Mark Payne
              markap14 Mark Payne
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: