Support Questions

Find answers, ask questions, and share your expertise
Announcements
Celebrating as our community reaches 100,000 members! Thank you!

Is it possible to use variable shared by different process groups?

avatar
New Contributor

Hi, I want ask a shared variable between non-associated Processors.

 

I have 2 separate Process Groups.
One group monitors the status of the API called log manager, and changes the variable 'Circuit_Break' to 'enable' through UpdateAttribute when the API status is bad.

 

Another group receives syslog as udp and put it in an API called log manager. At this time, if the variable called 'Circuit_Break' is 'enable' through RouteOnAttribute in the middle, alert with slack and try to execute ControlRate.

 

thisis Group 2

dreaminz_0-1669730938411.png

 

thisis Group 1

dreaminz_1-1669730964012.png

 

 

Is it possible to use variable shared by different process groups?
If not available, are there any other good ways?

 

I would like to periodically monitor the API and give a slight delay according to the API status.

When the API is in a bad state, I want to give it time to recover by adjusting the throughput(by ControlRate).

 

 
1 ACCEPTED SOLUTION

avatar
Super Mentor

@dreaminz 

You can create variables on a process group, those variables are then only available to that process group (scope) on which they were created.
NiFi documentation on Variables:
https://nifi.apache.org/docs/nifi-docs/html/user-guide.html#Variables

Variable shave been deprecated in favor of Parameter Contexts:
https://nifi.apache.org/docs/nifi-docs/html/user-guide.html#parameter-contexts

You can create a single parameter context that you add parameters to and then associate the parameter context with multiple process groups.  This will allow you to update a parameter in one parameter context  and effectively update your flows in multiple process groups.

If you found that the provided solution(s) assisted you with your query, please take a moment to login and click Accept as Solution below each response that helped.

Thank you,

Matt

View solution in original post

2 REPLIES 2

avatar
Super Mentor

@dreaminz 

You can create variables on a process group, those variables are then only available to that process group (scope) on which they were created.
NiFi documentation on Variables:
https://nifi.apache.org/docs/nifi-docs/html/user-guide.html#Variables

Variable shave been deprecated in favor of Parameter Contexts:
https://nifi.apache.org/docs/nifi-docs/html/user-guide.html#parameter-contexts

You can create a single parameter context that you add parameters to and then associate the parameter context with multiple process groups.  This will allow you to update a parameter in one parameter context  and effectively update your flows in multiple process groups.

If you found that the provided solution(s) assisted you with your query, please take a moment to login and click Accept as Solution below each response that helped.

Thank you,

Matt

avatar
Community Manager

@dreaminz Has the reply helped resolve your issue? If so, please mark the appropriate reply as the solution, as it will make it easier for others to find the answer in the future. Thanks

 


Regards,

Diana Torres,
Community Moderator


Was your question answered? Make sure to mark the answer as the accepted solution.
If you find a reply useful, say thanks by clicking on the thumbs up button.
Learn more about the Cloudera Community: