基于Json字段路由整个Json内容
我有以下JSON:基于Json字段路由整个Json内容,json,apache-nifi,Json,Apache Nifi,我有以下JSON: { "From": "stuart", "Payload": { "Alert": "Critical", "Recipient": "Joe" } } 我想根据警报中的字段是否为“关键”来路由此消息 我尝试了RouteOnAttribute处理器和EvaluateJson处理器。两者都不起作用 因为我已经试过了 警报:${Payload:jsonPath('$.Alert'):equals('Critical')}
{
"From": "stuart",
"Payload": {
"Alert": "Critical",
"Recipient": "Joe"
}
}
我想根据警报中的字段是否为“关键”来路由此消息
我尝试了RouteOnAttribute处理器和EvaluateJson处理器。两者都不起作用
因为我已经试过了
警报:${Payload:jsonPath('$.Alert'):equals('Critical')}
然后,我有一个基于Alerted的关系,但没有任何东西进入我的RouteOnAttribute处理器,队列就在那里,直到填满10000个
我需要路由完整的JSON,我不能在路由中丢失信息
问题在于jsonPath函数对流文件属性起作用,但您没有与流文件关联的有效负载属性 如何向流文件添加属性? 生成流文件处理器后,使用目标为流文件属性的处理器 添加新属性 payload.alert为$.payload.alert 然后使用routeonattribute processor将新属性添加为 已发出警报
${payload.alert:equals('Critical')}
流量:
1.GenerateFlowFile
2.EvaluateJsonPath //extract the value and keep as attribute to the flowfile
3.RouteOnAttribute //check the attribute value