我在 nifi.variable.registry.properties 的 nifi.properties 中配置了一个外部属性文件。我想在 python 的 executeScript 处理器中读取这个属性。我用过
str(context.getProperty('URL'))
但它不工作
VAR_URL = ${URL}
VAR_URL.evaluateAttributeExpressions(flowFile).getValue()
或者,如果您不想为处理器声明属性,并且确定在某处声明了该属性,则可以使用以下代码:
context.newPropertyValue( '${URL}' ).evaluateAttributeExpressions().getValue()
Run Code Online (Sandbox Code Playgroud)
注意:不要在周围使用双引号,
${URL}
因为在评估 nifi 表达式之前,此表达式将作为常规字符串处理...