Support Questions
Find answers, ask questions, and share your expertise
Announcements
Alert: Welcome to the Unified Cloudera Community. Former HCC members be sure to read and learn how to activate your account here.

Groovy Script to fetch the current flow file queueId and ProcessGroupId.

Groovy Script to fetch the current flow file queueId and ProcessGroupId.

New Contributor

Hello Everyone,

I have requirement such that, we need to fetch the current flow file queueId and ProcessGroupId using groovy script. These Id's will used in other system which driven by NIFI Rest api. I have written code for fetching the ProcessGroupId but not able to fetch queueId. So, how to fetch queueId?. Here is the script which i used to fetch ProcessGroupId.
Note: As part of these two Id's i am Interested in fetching of source, destination Id's and on which host this flowfile is processing.

 

def flowFile = session.get()
if(!flowFile) return
processGroupId = context.procNode?.processGroupIdentifier ?: 'unknown'
componentId = context.procNode?.serviceProvider ?: 'unknown'
flowFile = session.putAttribute(flowFile, 'processGroupId', processGroupId)
session.transfer(flowFile, REL_SUCCESS)

 

Please assist me on this. Thanks

Don't have an account?
Coming from Hortonworks? Activate your account here