Support Questions
Find answers, ask questions, and share your expertise

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