Ben, 1) Yes, the variables are hierarchical, so a variable at the root group would be visible to all components, unless there is a variable with the same name at a lower level which would override it.
2) I haven’t tried this, but I would expect that you should still be able to
use RouteOnAttribute to route on a variable… Lets say that your root group has
a variable “env” and in one environment you have this set to “dev” and in
another environment you have it set to “prod”. You might have a part of your
flow that you only run in “prod” so you put a RouteOnAttribute with something
like ${env:equals(“prod”)} which would only enable this path in prod.
Variables on their own are not associated with flow files, so if you wanted to
do something more specific per-flow file, then the only way would be what you
described with using UpdateAttribute.
Thanks,
Bryan
> On Oct 8, 2017, at 10:44 PM, 尹文才 <[email protected]> wrote:
>
> Hi guys, I've played around with the latest NIFI 1.4.0 release for a while
> and I think the new variable registry feature is great, however I have 2
> questions about this feature:
>
> 1. It seems that I could only add variables to a processor group, could I
> add a global variable in the NIFI root processor group so it could be used
> anywhere inside NIFI?
>
> 2. I want to route to different flows based on the variables I added, but
> currently the only way I know that could make this work is like this:
> myprocessor->updateAttribute(add the variable into FlowFile attribute)->
> routeOnAttribute->different flows based on the variable value
>
> I didn't find any routeOnVariable processor, is there any easier way that I
> could use to implement conditional flow in NIFI? Thanks
>
> /Ben
signature.asc
Description: Message signed with OpenPGP
