Support Questions

Find answers, ask questions, and share your expertise

How to achieve inheritence within Parameter Contexts in NiFi

avatar
Explorer

Hello Everyone,

                          As you know that , it is recommended to use Parameter rather than variables in Nifi as it is gonna get deprecated soon. 

                        I have two process groups PG1 and PG1A. PG1A is the child process group to PG1.

                        I have ParameterContext PC1 which has database and other common application configuration parameters and it is assigned to PG1. 

                       I would like to create new ParameterContext PC1A which has its own parameters specific to the process group PG1A and it should also inherit the common application parameters from PC1. How it can be achieved? Since we can't assign two different Parameter contexts(PC1 & PC1A) to one process group (PG1A).  Please provide your inputs.

                         

4 REPLIES 4

avatar
Explorer

As it stands now, in NiFi 1.11.4, it seems that PGs do not inherit the context of their parent. 😕 
It would certainly be nice if they added actual scoping rules and inheritance, rather then the all or nothing we have now. I don't see a good way to copy them either. 😞
So even if you wanted to have several sets of parameters with mostly the same values, and a few different, you have to do it the hard way.
Everything else seems to work by (optionally in some cases) inheriting from the parent, so it is puzzling that parameters do not.

avatar
Master Mentor

@karthikraja @Seedy 

 

Parameter Contexts are still relatively new.  There is an existing improvement Jira for exactly what you are looking for here that is currently in development.

  1. NIFI-8487

Unfortunately, there is not workaround or alternative to what you are trying to achieve other than recreating those common parameters in every parameter context you create currently.

 

If you found this query addressed your question, please take a moment to login and click accept on this solution.

Thank you,
Matt

avatar
Explorer

@MattWho 
Is this feature meanwhile implemented? The referenced JIRA ticket is still in progress but all sub-tasks are done. That's why I'm not sure about the current status.
I'm also very interested in this feature and would like to know if there is something like @karthikraja were initially asking for.

avatar
Master Mentor

@mirkom 
Yes Parameter Context inheritance does exist now.  Been implemented since Apache NiFi 1.15, but had numerous bugs/improvements addressed/implemented since then.

From within the "Parameter Contexts" UI, select the parameter context used by Process group and select "edit" from 3 dot menu to far right.  Will open UI that looks like this:

MattWho_0-1762368589330.png

Select the "Inheritance" tab along the top of this UI.  Drag and drop any of the Available Parameter Contexts form the left-hand side to the "selected Parameter Contexts" list on the right-had side.  The order in which the Selected Parameter Contexts are ordered in the list is important.  The top most takes precedence over those below it. 

MattWho_1-1762368934891.png

 

So above shows an example where my "test-param" parameter context is inheriting parameters from the "Root-PG-PC" parameter context.

So lets say you have an identical parameter "name" defined in multiple selected parameter contexts.   The one defined directly on the PG assigned Parameter context is used.  If parameter by that name does not exist there its starts searching inherited parameter contexts from top down.  First match found is used.

 

Please help our community grow. If you found any of the suggestions/solutions provided helped you with solving your issue or answering your question, please take a moment to login and click "Accept as Solution" on one or more of them that helped.

Thank you,
Matt