gpt4 book ai didi

apache-nifi - 如何在 Nifi 中引用环境变量?

转载 作者:行者123 更新时间:2023-12-05 01:19:04 29 4
gpt4 key购买 nike

我想在我的 Nifi 处理器中引用一个环境变量(一个 linux 环境变量)。我尝试通过直接在处理器属性中引用 ${MY_VARIABLE_NAME} 来使用表达式语言。但这似乎不起作用。这可能吗?如果是,怎么办?

感谢您的建议。

最佳答案

您可以按照您的描述在 NiFi 表达式语言中引用环境变量。如果它不起作用,您可以检查几项:

  • 处理器属性支持表达式语言
  • 环境变量是为NiFi进程定义的(对比${USER}${PATH})
  • 在 EL 评估中没有其他同名属性优先于环境变量

这在 Structure of a NiFi Expression 中有简要讨论。在关于转义的 NiFi 表达式语言指南中:

For example, the following can be used to escape an attribute named “my attribute”: ${"my attribute"} or ${'my attribute'}.

In this example, the value to be returned is the value of the "my attribute" value, if it exists. If that attribute does not exist, the Expression Language will then look for a System Environment Variable named "my attribute." If unable to find this, it will look for a JVM System Property named "my attribute." Finally, if none of these exists, the Expression Language will return a null value.

关于apache-nifi - 如何在 Nifi 中引用环境变量?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42230392/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com