[
https://issues.apache.org/jira/browse/NIFI-2585?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15733316#comment-15733316
]
ASF GitHub Bot commented on NIFI-2585:
--------------------------------------
Github user bbende commented on the issue:
https://github.com/apache/nifi/pull/1307
@randerzander I tested this out and I think we have to move the addition of
the attributes to inside the loop where the flow files are being created. If we
do it after the loop, then session.transfer has already been called on each
flow file and we can no longer update it, it was causing an error when I tested
it out.
I made a couple of updates and have a working version in the latest commit
here:
https://github.com/bbende/nifi/commits/NIFI-2585
The changes I made were the following:
1) Move the attributes into the while loop in AbstractFlowFileServerProtocol
2) Added the same attributes in StandardRemoteGroupPort for pull-based
site-to-site
3) Used "s2s." prefix for the attribute names (I know I suggest "remote."
in the JIRA, but I started thinking it wasn't descriptive enough).
I tested this out with two NiFi instances on my laptop doing push and pull
based s2s and it appears to be working correctly.
If you agree with the changes you could put my commit into your branch and
update this PR, or if you want to close this I can submit my branch with both
our commits as a new PR.
> Add attributes to track where a flow file came from when receiving over
> site-to-site
> ------------------------------------------------------------------------------------
>
> Key: NIFI-2585
> URL: https://issues.apache.org/jira/browse/NIFI-2585
> Project: Apache NiFi
> Issue Type: Improvement
> Reporter: Bryan Bende
> Assignee: Randy Gelhausen
> Priority: Minor
>
> With MiNiFi starting be used to send data to a central NiFi, it would be
> helpful if information about the sending host and port was added to each flow
> file received over site-to-site. Currently this information is available and
> used to generate the transit URI in the RECEIVE event, but this information
> isn't available to downstream processors that might want to make routing
> decisions.
> For reference:
> https://github.com/apache/nifi/blob/e23b2356172e128086585fe2c425523c3628d0e7/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-site-to-site/src/main/java/org/apache/nifi/remote/protocol/AbstractFlowFileServerProtocol.java#L452
> A possible approach might be to add two attributes to each flow file,
> something like "remote.host" and "remote.address" where remote.host has only
> the sending hostname, and remote.address has the sending host and port.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)