2

I had a 3 flowfiles which are coming from the same processor.

FF1 -> {a:1,b:2,c:'name'}

FF2 -> {a:1,b:5,c:'fruit'}

FF3 -> {a:2,b:3,c:'abc'}

By using MergeContent Processor I'm able to merge all the flow files, but my requirement is to merge flow files on Key.

Expected output if I join with Key 'a':

FF1 -> [{a:1,b:2,c:'name'},{a:1,b:5,c:'fruit'}]

FF2 -> [{a:2,b:3,c:'abc'}]

Karthik Mannava
  • 207
  • 1
  • 5
  • 12

1 Answers1

5

MergeContent has a property called "Correlation Attribute" which is the name of a flow file attribute that will be used to group together flow files with the same value for the attribute (the key in your example).

You will need to extract the value of field "a" into a flow file attribute using something like EvaluateJsonPath, or ExtractText, or some custom scripted processor, then once you get into an attribute like "my.key" then you put "my.key" into the Correlation Attribute property.

Bryan Bende
  • 18,320
  • 1
  • 28
  • 39
  • Can we give two Atrributes in "Correlation Attribute" ? – Karthik Mannava Jun 28 '18 at 14:58
  • 2
    @KarthikMannava It can only be one attribute, but you can easily put an UpdateAttribute right before and create a new attribute like c = ${a}_${b} which will now be the combined values of a and b – Bryan Bende Jun 28 '18 at 15:46