Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NIFI-13393 Support passing in FF attributes to create Flow File #8968

Closed
wants to merge 1 commit into from

Conversation

jrsteinebrey
Copy link
Contributor

@jrsteinebrey jrsteinebrey commented Jun 15, 2024

method to avoid an extra flow file from being created

This PR is a proposal to see if the PMC agrees with this API change.
I have not written any new unit tests for this PR yet until I get buy-in on it.

I added two new create methods to the API of ProcessSession to allow the option of
passing in ff attributes to be added to the flow file being created. This is not
a breaking change because the original create methods are still there.

ProcessSession
FlowFile create(FlowFile parent, final Map<String, String> attributes);
FlowFile create(final Map<String, String> attributes);

Changing a core API is a very significant change but I hope people will see it
as worthwhile to allow us to to avoid creating an extra FlowFile object in many
places that FlowFiles are created. Not all places set attributes right after
FF creation, but very many of them do and could benefit.

There are 150+ places where these new methods can be used and I only changed the
GenerateTableFetch processor to call them so you how the new methods are used.
I expect using these new create methods has the potential to
avoid noticeable transient memory allocation like the earlier API addition of
SessionContext.isAutoTerminated did.

Also if this PR is approved, myself and others can change processors to call these
new methods in a future PRs (not as part of this PR).

Summary

NIFI-13393

Tracking

Please complete the following tracking steps prior to pull request creation.

Issue Tracking

Pull Request Tracking

  • Pull Request title starts with Apache NiFi Jira issue number, such as NIFI-13393
  • Pull Request commit message starts with Apache NiFi Jira issue number, as such NIFI-13393

Pull Request Formatting

  • Pull Request based on current revision of the main branch
  • Pull Request refers to a feature branch with one commit containing changes

Verification

Please indicate the verification steps performed prior to pull request creation.

Build

  • Build completed using mvn clean install -P contrib-check
    • JDK 21

Licensing

No new files or dependencies

Documentation

No documentation changes.

…d to avoid an extra flow file from being created
@joewitt
Copy link
Contributor

joewitt commented Jun 15, 2024

Provided thoughts on the mailing list thread for this PR. This should be considered a draft/not merged pending commentary/progress on that thread.

@jrsteinebrey jrsteinebrey marked this pull request as draft June 15, 2024 18:47
@jrsteinebrey
Copy link
Contributor Author

Closing based on discussion in email thread that the benefit is too small for the less expressive code tradeoff.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants