Referencing Source File Attributes with MergeContent Processor

2015-10-14 Thread Chris Mangold
I have use case where I am trying to merge content using the NIFI
MergeContent processor.

Scenario is that I am retrieving image files from a server, base64 encoding
them and then batching them together into a JSON format using MergeContent.
I am using the Header, Footer and Demarcator fields to constuct a JSON
object array:

[...

{

"id": 

"base64": from merged flow file

}

..

]

Using the the NIFI expression language I was hoping to reference an
attribute on the incoming files to populate the "id" field, and have it
unique. All works well except my "id" files are the same for all the merged
files. By using the expression language it appears the attribute value from
only one of the files is being evaluated.

Example of my expression language:
"},{"recordid":${RecordID:trim()},"base64Image":


Any advice would be helpful.

Thanks in advance.


Chris


-- 
Chris Mangold
301-471-5758 (c)
301-898-7979 (h)


Re: Referencing Source File Attributes with MergeContent Processor

2015-10-14 Thread Bryan Bende
I'm not sure if this makes sense with out seeing the full flow, but can you
construct the Json for each image before MergeContent by using ReplaceText,
this way the id will already be taken care of before merging?


On Wednesday, October 14, 2015, Chris Mangold  wrote:

> I have use case where I am trying to merge content using the NIFI
> MergeContent processor.
>
> Scenario is that I am retrieving image files from a server, base64
> encoding them and then batching them together into a JSON format using
> MergeContent. I am using the Header, Footer and Demarcator fields to
> constuct a JSON object array:
>
> [...
>
> {
>
> "id": 
>
> "base64": from merged flow file
>
> }
>
> ..
>
> ]
>
> Using the the NIFI expression language I was hoping to reference an
> attribute on the incoming files to populate the "id" field, and have it
> unique. All works well except my "id" files are the same for all the merged
> files. By using the expression language it appears the attribute value from
> only one of the files is being evaluated.
>
> Example of my expression language:
> "},{"recordid":${RecordID:trim()},"base64Image":
>
>
> Any advice would be helpful.
>
> Thanks in advance.
>
>
> Chris
>
>
> --
> Chris Mangold
> 301-471-5758 (c)
> 301-898-7979 (h)
>


-- 
Sent from Gmail Mobile