从Nifi的配置文件中读取

Rav*_*ran 1 apache-nifi

我正在尝试在Nifi中读取配置文件(conf.txt).基于此文件中提供的路径,我想在nifi处理器中配置路径(例如:hdfs文件路径,输入目录路径).

可以使用现有的处理器,还是应该使用自定义处理器.

任何人都可以帮我这个.

Jam*_*mes 5

您可以将自定义属性配置为Apache NiFi的变量注册表功能的一部分,该功能使外部文件中的属性可用于NiFi表达式语言表达式.使用表达式语言,您可以使用外部定义的变量配置许多处理器.

CONF/nifi.properties

# external properties files for variable registry
# supports a comma delimited list of file locations
nifi.variable.registry.properties=./conf/custom.properties
Run Code Online (Sandbox Code Playgroud)

CONF/custom.properties

my.prop1=value1
my.prop2=value2
...
Run Code Online (Sandbox Code Playgroud)

在表达式中

${my.prop1}
Run Code Online (Sandbox Code Playgroud)