carousallie
carousallie

Reputation: 863

Generate UUID5 in NiFi

In NiFi, I have a flow file with an attribute RSID. I need to generate a UUID v5 based on RSID and add it as an attribute to the flow file. This uuid needs to be based on RSID because some reports will have the same RSID and need to thus have the same UUID5.

I've seen some methods in Groovy that will generate a random uuid, but not v5 nor based on a string. Is this possible to do in Groovy/NiFi? If so, how would this be done? I'm very new to Groovy.

Upvotes: 1

Views: 1091

Answers (1)

mattyb
mattyb

Reputation: 12083

You can indeed do this with Groovy and NiFi using the ExecuteScript processor. This SO post includes the code for generating a UUID v5 which you can apply to your RSID namespace. If you want some pointers on using the NiFi API from ExecuteScript, feel free to check out my cookbook series, hopefully it will help you assemble a working solution.

I have also written a Jira to add a UUID5 function to NiFi Expression Language, to make this easier.

Upvotes: 1

Related Questions