首页 文章

如何在NiFi中使用计数器的 Value

提问于
浏览
0

在NiFi 1.3.0中,我创建了一个流程来拆分JSON文件并使用名称 filenamecounter 更新计数器,以便我可以将每个拆分保存到不同的文件名中 . 我看到当我查看NiFi计数器窗格时,计数器值会更新 . 但是如何获取此值?

我尝试使用计数器名称和计数器属性设置属性 . 像 ${filenamecounter}${filenamecounter.counter} 但不成功 .

enter image description here

1 回答

  • 1

    目前计数器主要是监视功能,您无法从表达式语言中真正访问它们 . 他们习惯于回答诸如“我从源xyz收到多少消息?”之类的问题 .

    在您的情况下,所有“拆分”处理器应该编写一组标准的片段属性:

    @WritesAttribute(attribute = "fragment.identifier",
        description = "All split FlowFiles produced from the same parent FlowFile will have the same randomly generated UUID added for this attribute"),
    @WritesAttribute(attribute = "fragment.index",
        description = "A one-up number that indicates the ordering of the split FlowFiles that were created from a single parent FlowFile"),
    @WritesAttribute(attribute = "fragment.count",
        description = "The number of split FlowFiles generated from the parent FlowFile"),
    

    所以你应该可以在你的文件名中使用$ .

相关问题