NIFI-2585: Add attributes to track where a flow file came from when receiving over site-to-site

Signed-off-by: Bryan Bende <bbende@apache.org>
This commit is contained in:
Randy Gelhausen 2016-12-07 02:18:09 -05:00 committed by Bryan Bende
parent 44c9ea0a66
commit 28e5d85493
No known key found for this signature in database
GPG Key ID: A0DDA9ED50711C39
1 changed files with 6 additions and 0 deletions

View File

@ -506,6 +506,12 @@ public abstract class AbstractFlowFileServerProtocol implements ServerProtocol {
throw new ProtocolException(this + " Received unexpected Response Code from peer " + peer + " : " + confirmTransactionResponse + "; expected 'Confirm Transaction' Response Code");
}
// For routing purposes, downstream consumers often need to reference Flowfile's originating system
for (FlowFile flowFile : transaction.getFlowFilesSent()){
flowFile = session.putAttribute(flowFile, "remote.host", peer.getHost());
flowFile = session.putAttribute(flowFile, "remote.address", peer.getHost() + ":" + peer.getPort());
}
// Commit the session so that we have persisted the data
session.commit();