Support Questions

Find answers, ask questions, and share your expertise
Announcements
Celebrating as our community reaches 100,000 members! Thank you!

Attribute Value length Limit In Nifi

avatar
Explorer

Hi, 

 

I have the requirement where I am converting the base64 Image content to attribute and after that I am preparing the payload including the base64 Image content. But the problem is while converting the base64 Image content (approx. 6-7 MB size ) it is getting truncated in the attribute Value. 

 

Can you please tell me what is the length limit of attribute value in NIFI.

Appreciate your help. Thank you.

2 ACCEPTED SOLUTIONS

avatar
Expert Contributor

Hello,

 

the maximal value length of an attribute is 2147483647 (max Integer)

 

Greetings

View solution in original post

avatar
Expert Contributor

Ok, there are 2 cases.

 

1. 

You use Base64EncodeContent to encode your image and after that with ExtractText there you write the content of your flowfile to an attribute.

There you have to set the property Maximum Capture Group Length to your desired length. I would prefer that you also set Maximum Buffer Size to ~10 MB that the process gets fully buffered.

 

2. 

Use Processor ExecuteStreamCommand 

Properties:

Command Arguments: -w 0

Command Path: base64

Output Destination Attribute: attribute.base64

Max Attribute Length: your desired length

 

If you dont work with one of those 2 cases, then please describe your flow 🙂  

 

View solution in original post

7 REPLIES 7

avatar
Expert Contributor

Hello,

 

the maximal value length of an attribute is 2147483647 (max Integer)

 

Greetings

avatar
Explorer

Hi @Faerballert ,

 

Thanks for the reply. Can we increase the length of an attribute. If so what needs to be done here?

 

 

avatar
Expert Contributor

Ok, there are 2 cases.

 

1. 

You use Base64EncodeContent to encode your image and after that with ExtractText there you write the content of your flowfile to an attribute.

There you have to set the property Maximum Capture Group Length to your desired length. I would prefer that you also set Maximum Buffer Size to ~10 MB that the process gets fully buffered.

 

2. 

Use Processor ExecuteStreamCommand 

Properties:

Command Arguments: -w 0

Command Path: base64

Output Destination Attribute: attribute.base64

Max Attribute Length: your desired length

 

If you dont work with one of those 2 cases, then please describe your flow 🙂  

 

avatar
Explorer

Hi @Faerballert , I am following the first flow but while converting content of flowfile to an attribute using ExtractText the value of the attribute is getting truncated . Is there any way that we can resize the image in NiFi? I checked for Resize image processor but its not available.

Can you please suggest.    

avatar
Expert Contributor

@Techie123 can you show the properties of the processor?

Can you maybe check if the base64 string length is for real longer than the max integer value?

 

With ExecuteStreamCommand you can resize your image.

 

Attributes should actually be kept small, so it's not the optimal solution either.
Maybe you can also define the workflow a bit, for which you need the string in an attribute - maybe you can work around that?!

avatar
Explorer

Hi @Faerballert ,

 

I am converting the base64 image content to attribute because i am preparing the payload for the same.

Techie123_0-1667982349471.png

I have attached the snapshot of the payload. file_content.0 is nothing but the content of the file that i have converted into the attribute using ExtractText processor and using it into the payload 

 

avatar
Explorer

@Faerballert , can you please reply if you have the solution for this or can you share the code to resize the attachment from the mailbox