Skip to main content
cbravom
Bronze III
Feb 16, 2024 10:16 PM UTC
Solved

Capture de content of a file in Nifi from HDFS

Hi, I have a GetHDFS processor that reads a .TXT and I need to read the content and send a email combined the content with some other default text. I tried a UpdateAttribute to capture flowfile-content and then used in PutEmail sendMessage as Hi ${content} for example, but always get a empty string.

Someone can help me

MattWho
MattWhoAnswer
Titanium ⭐️⭐️
Feb 16, 2024 11:56 PM UTC

@cbravom 

The UpdateAttribute processor does not read the content of the FlowFile. It is used to add or modify attributes/metadata on the NiFi FlowFile.  

For extracting the content to the FlowFile, you'll want to use a processor like ExtractText.  Keep in mind that the FlowFile attributes for all active FlowFiles is held in NiFi's heap memory.  If you can avoid extracting the content to attribute(s) and still satisfy your user case, that would be much more efficient.

If you found that any provided answer helped you, please take a moment to login and click accept below those answers.

Matt

3 replies

DianaTorres
Community Manager
Community Manager
Feb 16, 2024 11:14 PM UTC

@cbravom Welcome to the Cloudera Community!

To help you get the best possible solution, I have tagged our NiFi experts @MattWho @SAMSAL @joseomjr  who may be able to assist you further.

Please keep us updated on your post, and we hope you find a satisfactory solution to your query.

Translate
Regards, Diana Torres, Senior Community Moderator
MattWho
Titanium ⭐️⭐️
MattWhoAnswer
Titanium ⭐️⭐️
Feb 16, 2024 11:56 PM UTC

@cbravom 

The UpdateAttribute processor does not read the content of the FlowFile. It is used to add or modify attributes/metadata on the NiFi FlowFile.  

For extracting the content to the FlowFile, you'll want to use a processor like ExtractText.  Keep in mind that the FlowFile attributes for all active FlowFiles is held in NiFi's heap memory.  If you can avoid extracting the content to attribute(s) and still satisfy your user case, that would be much more efficient.

If you found that any provided answer helped you, please take a moment to login and click accept below those answers.

Matt

Translate
DianaTorres
Community Manager
Community Manager
Feb 20, 2024 3:28 PM UTC

@cbravom Has the reply helped resolve your issue? If so, please mark the appropriate reply as the solution, as it will make it easier for others to find the answer in the future. Thanks.

Translate
Regards, Diana Torres, Senior Community Moderator