Support Questions

Find answers, ask questions, and share your expertise

Retrieve Value of Signal Counter in Wait/Notify Processes

avatar
Explorer

I am using a wait/notify process to trigger a notification indicating that a group of FlowFiles has completed processing.  I am using multiple Signal Counter Names (e.g. failed, succeeded) and FlowFiles are released by the corresponding Wait processor once the sum total of all the unique Signal Counters for a given Release Signal Identifier equals the Target Signal Count (in this case, the target signal count is equal to the number of FlowFiles that must be processed.

 

Below is an example of my wait processor configured to use the attribute "keyId" (shared across all related FlowFiles) as the Release Signal Identifier and update the Signal Counter named "succeeded" under the given Release Signal Identifier.

rstewart_0-1598389785244.png

 

 

I would like to be able to query the value of a specific Signal Counter (e.g. succeeded) for a given Release Signal Identifier from the DistributedMapCache configured in the Wait/Notify processors.  Is this possible, and if so, how can I do this (preferably using built in NiFi components or alternatively in Groovy)?

1 REPLY 1

avatar
Expert Contributor

@rstewart  Counter is in-memory content for NiFi service. There is no direct way to get value of particular counter. But you can try below call to get a json response from NiFi about all counters.

curl -v -X GET "https://$HOSTNAME:9091/nifi-api/counter" -H "Authorization: Bearer $TOKEN" -H "Connection: close" -k

Once you get the Json response you can parse it as per your use case