如何在 NIFI 中对 json 响应应用条件 [英] how to apply condition on json response in NIFI

查看:33
本文介绍了如何在 NIFI 中对 json 响应应用条件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

{


"alamrs": [
{ 
  "correlate": [
    " ", 
    " ", 
    " " 
  ], 
"event": " ", 
  "group": " ", 
  "history": [
    {
      "event": " ", 
      "href": " ", 
      "id": " ", 
      "resource": " abc ", 
      "status": " ", 
      "text": " ", 
      "type": " ", 
      "updateTime": " ", 
      "user": " ", 
      "value": "--"
    }
  ],

  "href": " ", 
  "id": "", 
  "rawData": null, 
  "receiveTime": " ", 
  "service": [
    " "
  ], 
"resource": "abc", 
  "status": " ", 
  "tags": [
    ""
  ], 
"text": " : ", 
  "timeout": , 
}, 
{ 
"correlate": [
    " ", 
    " ", 
    " " 
  ], 
"event": " ", 
  "group": " ", 
  "history": [
    {
      "event": " ", 
      "href": " ", 
      "id": " ", 
      "resource": " abc ", 
      "status": " ", 
      "text": " ", 
      "type": " ", 
      "updateTime": " ", 
      "user": " ", 
      "value": "--"
    }
  ],

  "href": " ", 
  "id": "", 
  "rawData": null, 
  "receiveTime": " ", 
  "service": [
    " "
  ],
"resource": "abc", 
  "status": " ", 
  "tags": [
    ""
  ], 
"text": " : ", 
  "timeout": , 
}, 
{ 
  "correlate": [
    " ", 
    " ", 
    " " 
  ], 
"event": " ", 
  "group": " ", 
  "history": [
    {
      "event": " ", 
      "href": " ", 
      "id": " ", 
      "resource": " abc ", 
      "status": " ", 
      "text": " ", 
      "type": " ", 
      "updateTime": " ", 
      "user": " ", 
      "value": "--"
    }
  ],
"href": " ", 
  "id": "", 
  "rawData": null, 
  "receiveTime": " ", 
  "service": [
    " "
  ], 
"resource": "abc", 
  "status": " ", 
  "tags": [
    ""
  ], 
  "text": " : ", 
  "timeout": , 
}

[这里我使用了 http 调用的处理器,它从 Web 应用程序获取警报......这个处理器的响应是 json 格式......实际上我希望这个警报基于资源 =abc 得到过滤器 ..i意思是说具有存储在文本文件中的资源 = abc 的警报][routedonatrribute configration--property_name=condtion value=${alamrs.resource:equals('abc')}]1[evalutejsonpath---(property=destination-value=flowfile-attribute)(propety_name=condition value=$.alamrs.resource)]1[完整数据流]1[1]: https://i.stack.imgur.com/f0pCF.png

[here i have used http invoked processor which get alarm from web app ....the response of this processor is in json format ...actually i want this alarm get filter on the bases of resource =abc ..i meant to say the alarm that have the resource = abc which are store in text file ][routedonatrribute configration--property_name=condtion value=${alamrs.resource:equals('abc')}]1[evalutejsonpath---(property=destination- value=flowfile-attribute) (propety_name=condition value=$.alamrs.resource)]1[complete data flow]1[1]: https://i.stack.imgur.com/f0pCF.png

推荐答案

我建议使用 PartitionRecord 带有 JsonPathReader 使用 /*[./alarms/resource=abc] 到一个关系,其他关系到不同的关系.

I'd suggest using PartitionRecord with a JsonPathReader to send all records in the flowfile with /*[./alarms/resource=abc] to one relationship and the others to a different relationship.

这篇关于如何在 NIFI 中对 json 响应应用条件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆